The ruling will not take effect right away, giving the administration time to appeal to the Supreme Court.