President Trump’s refugee and visa ban is still on hold — and its future isn’t looking good.

The Ninth Circuit Court of Appeals just rejected an attempt by the Justice Department to reinstate the ban, after District Judge James Robart put a temporary restraining order on it last week.

The court’s decision (issued by three judges in a unanimous ruling) means that the federal government will have to keep allowing visa holders from seven majority-Muslim countries, as well as refugees, to enter the United States — at least until it can get a favorable court ruling (either on appeal or a second ruling from the judge that initially put the ban on hold) in a case where it’s now 0-for-2.

The ban, which was in place due to an executive order signed by President Trump on January 27, was in effect for a week before Judge Robart put it on hold — but several other court challenges, and a botched rollout, made its implementation rocky from the start. Thanks to the Ninth Circuit, the possibility is dawning that, at least in its current form, it may not go back into effect for a while — if ever.

The ruling is a huge blow to the Trump administration. Not only did the Ninth Circuit reject its request to reinstate the ban, but the judges made it quite clear, in oral arguments and in the written ruling, that they are not convinced the executive order was constitutional at all: “The government has not shown a likelihood of success on the merits of an appeal” of the stay, the panel wrote.

Furthermore, the court strenuously rejected the legal argument the Trump administration had made in oral argument. The ruling called the federal government’s argument “contrary to the fundamental structure of our constitutional democracy.”

President Trump has all but promised to appeal to the Supreme Court — something that would be relatively unusual, given that this is, after all, still a very preliminary ruling in the case. But this court battle, so far, has been about much more than legal procedure. It’s a fight over the policy that’s defined the still-young Trump administration — and a battle between a president who promises to do whatever it takes to ensure “security” and an opposition that sees “security” as a flimsy excuse for xenophobia and discrimination.

The judges could have ruled narrowly — but chose to go broader

The Ninth Circuit could have issued a relatively narrow ruling; it could have dismissed the government’s request because there hasn’t been enough time for either side to make its case. (That would have given Robart, the lower court judge, the chance to decide whether to issue an indefinite injunction against the ban or let it go back into effect after a week or two.)

But instead, it straightforwardly upheld Robart’s decision — and rejected the government’s argument that the ban is needed to protect America from immediate harm.

The temporary restraining order, legally speaking, doesn’t necessarily mean the judges intend to strike down the ban for good. It’s supposed to preserve the status quo from before the ban (because it’s easier to prevent the possibly harmful effects of something than to reverse them) while the court figures out whether it’s constitutional or not.

The government argued that not having the refugee and visa ban in place would cause the United States immediate harm, by increasing the risk of a terrorist attack.

That argument has often inspired deference from judges; they don’t think it’s their job to weigh security risks. But the Ninth Circuit has rejected it.

Breaking: Ninth Circuit refuses to lift order blocking Trump travel ban...link to opinion https://t.co/dz8O6JKJwm pic.twitter.com/75xp7RKcRK — Jacob Gershman (@jacobgershman) February 9, 2017

The states in this case have argued that — from its origins as a campaign promise to ban “Muslims” from entering the US to President Trump’s promise, the day the executive order was signed, to make an exception to the refugee ban for “Middle Eastern Christians” — there’s a lot of evidence that this ban is discriminatory in a way that’s too blatant for the courts to ignore.

The judges aren’t necessarily convinced that the ban is unconstitutional — at least not yet. (No judge has officially ruled on the merits of the executive order; these are all preliminary rulings about what the government can and can’t do while the courts are considering the case.)

But they really didn’t like the federal government’s contention that the executive order is beyond the scope of the courts to review at all:

There is no precedent to support this claimed unreviewability, which runs contrary to the fundamental structure of our constitutional democracy. See Boumediene v. Bush, 553 U.S. 723, 765 (2008) (rejecting the idea that, even by congressional statute, Congress and the Executive could eliminate federal court habeas jurisdiction over enemy combatants, because the “political branches” lack “the power to switch the Constitution on or off at will”). Within our system, it is the role of the judiciary to interpret the law, a duty that will sometimes require the “[r]esolution of litigation challenging the constitutional authority of one of the three branches.” Zivotofsky ex rel. Zivotofsky v. Clinton, 566 U.S. 189, 196 (2012) (quoting INS v. Chadha, 462 U.S. 919, 943 (1983)). We are called upon to perform that duty in this case.

The Ninth Circuit is resisting the Trump administration

During an oral argument on Tuesday, judges pushed the attorney representing the Justice Department to offer evidence that people from the seven blacklisted countries posed a particular threat to the United States. They rejected the government’s argument that previous laws passed by Congress (and Obama administration policies) that subjected those countries to extra scrutiny were a good basis for banning their people entirely.

By pressing the government to show its work, the judges indicated that they might ultimately hold the Trump administration to a higher standard to prove the order was constitutional — that it isn’t discriminating against people of particular nationalities, or against Muslims.

At one point in the oral argument, the judges asked, incredulously, whether the Trump administration felt that it could explicitly ban Muslim immigration and have it be constitutional. The DOJ didn’t answer — but it did admit, in a related line of questioning, that it didn’t think the executive order was reviewable by the courts at all.

That’s a logical extension of the legal arguments that the executive and legislative branches have “plenary power” over immigration policy. But it’s one that, in rejecting the stay request, the Ninth Circuit has dismissed.

It’s impossible to tell what impact, if any, President Trump’s apparent disregard for the judiciary has on the judges’ attitude toward his Justice Department. But it’s hard to imagine that judges would be more inclined to defer to the executive branch when the president is preemptively blaming them for future terrorist attacks.

Just cannot believe a judge would put our country in such peril. If something happens blame him and court system. People pouring in. Bad! — Donald J. Trump (@realDonaldTrump) February 5, 2017

The federal government might decide to ask the Ninth Circuit to hear its case again, with a larger panel of judges (11 instead of three). But given how liberal the Ninth Circuit is, the government is unlikely to fare much better with more judges on the bench. Instead, it might do what President Trump has hinted at, and appeal the temporary restraining order to the Supreme Court.

It’s hard to predict what the Supreme Court would do with the case, especially because it’s still in its early stages. It might not even get enough of its eight justices to agree to hear the government’s appeal. But it’s also possible that the Supreme Court will find it impossible to resist playing a role, as soon as possible, in a legal battle that has become the biggest fight of the young and ambitious Trump administration.