Ruling in a lawsuit late Monday night, a federal judge in San Francisco put the Trump administration’s asylum ban—an unprecedented move that barred asylum to any individual crossing the Southern border between ports of entry—on hold.

Citing the Immigration and Nationality Act, which provides that any person may apply for asylum “whether or not they entered at a port of entry, District Court Judge Jon S. Tigar declared that the ban violated Congress’s intent to make asylum available regardless of how a person enters the United States. The judge then issued a nationwide temporary restraining order against the ban.

The Trump administration’s asylum ban consisted of two parts. First, President Trump issued a proclamation barring the entry of all individuals who cross the southern border between ports of entry. The Attorney General and the Department of Homeland Security then issued an emergency regulation that went into effect immediately, banning asylum to any person who crossed the border in violation of the presidential proclamation.

The lawsuit challenging the asylum ban only sought to overturn the regulation, as the government agreed that the presidential proclamation on its own did not bar people from seeking asylum.

The plaintiffs argued that the regulation violated the Immigration and Nationality Act, and that the emergency regulation should have gone through a more detailed “notice and comment” period rather than being put into place with no opportunity for the public to participate in the establishment of the new regulation. The judge has yet to rule on whether the government inappropriately issued the regulation before allowing the public to comment.

Throughout his ruling, Judge Tigar made clear that the Trump administration’s asylum ban was flawed from the beginning. He declared that “Not only does the Rule flout the explicit language of the statute, it also represents an extreme departure from prior practice.”

In the past, unlawful entry has been a single factor that a judge may consider in deciding whether to grant asylum, but judges were not permitted to deny asylum on that basis alone.

For decades, courts have recognized that the principle of providing a safe haven from persecution overrode any consideration how someone entered the country. Indeed, the United Nations Protocol Relating to the Status on Refugees—which the United States is a party to—declares that countries in general “shall not impose penalties, on account of their illegal entry or presence, on refugees” who promptly present themselves and ask for asylum.

Although the United States is not bound by the United Nationals Protocol, Judge Tigar noted that it was a good indication of Congress’s “unambiguous intent” to keep asylum available regardless of how people enter.

Judge Tigar’s decision has put the government’s asylum ban on hold for now, but the fight is certainly not over. The administration is almost certain to appeal this decision and has indicated that it’s willing to take the case all the way to the Supreme Court. Indeed, before the asylum ban was even put into effect, senior administration officials reportedly indicated that they expected to lose the case until it makes it to the Supreme Court. But the officials hoped with Justice Kavanaugh on the bench, they’ll ultimately win.