David Cole is National Legal Director of the ACLU, which has filed several challenges to President Trump’s executive order on refugees.

So much for that “so-called judge.” That was how President Trump dismissively referred to Judge James L. Robart, a George W. Bush appointee, on Feb. 4, a day after Robart issued a nationwide temporary injunction against the president’s executive order barring entry from seven predominantly Muslim countries. Robart’s ruling followed several more limited injunctions issued by federal judges from New York, Massachusetts, Virginia and California. Now, his order has been unanimously affirmed by a three-judge panel of the U.S. Court of Appeals for the 9th Circuit, comprising judges appointed by presidents Bush, Carter and Obama. We’ll see whether Trump will condemn the entire judiciary as “so-called,” but thus far they have done their job: to provide a bulwark for liberty in the face of executive overreaching.

The executive order, issued Jan. 27, sought to make good on candidate Trump’s promise to impose a “Muslim ban.” As Rudy Giuiliani told Fox News, the president called Giuliani to ask how he could implement a Muslim ban that would withstand legal challenge. Giuliani recommended that he target not Muslims per se, but countries that happened to be predominantly Muslim. But Trump apparently didn’t get the full message. The day the order issued, Trump appeared on Christian Broadcast News to explain the order was designed to prioritize Christian refugees over Muslim refugees. (A separate provision of the order allows refugees who are members of a “minority” faith in their country to avoid a ban on refugee admissions).

That’s like a governor signing a “voter ID” law and simultaneously holding a news conference to announce that the purpose of the law is to suppress black votes. It admits a blatantly unconstitutional purpose, because, as the 9th Circuit noted, both the establishment clause and the equal protection clause prohibit the government from favoring or disfavoring specific religious denominations.

The executive order violates the principle of denominational neutrality in two ways. First, it is expressly designed to disfavor Muslims and favor Christians. And second, even if one disregarded Trump’s admission of unconstitutional intent, the order creates a wholly arbitrary preference for refugees from “minority” religions over those from “majority” religions - in every country of the world. What possible rationale could there be for such a preference? And implementing it would entangle the government in theological questions about how to define religious groups and when a sect should be treated as a distinct religion. Are Baptists and Catholics and Unitarians three different religions, or one? What about Sunni and Shiite Muslims?

Taking a page from the Bush administration, the Trump administration argued that its executive order could not be reviewed at all by the judiciary. Such arguments rarely go down well with members of the judicial branch — even when a president has not dismissed them as “so-called judges.” The Supreme Court rejected the contention when Bush advanced it with respect to enemy combatants at Guantanamo Bay. And the 9th Circuit just as rightly rejected it when advanced with respect to those subject to the travel ban. To be a country under the rule of law means that executive power cannot go unchecked.

The administration also maintained that because the executive order principally targets foreign nationals overseas who are not entitled to constitutional protections, the court should disregard constitutional objections. But as the 9th Circuit pointed out, the order affects many persons within the United States as well, including lawful permanent residents and those here on student or work visas, who would be barred from reentry if they took a trip home. The Supreme Court has insisted that constitutional rights generally apply to all those living among us, whether here lawfully or unlawfully. Moreover, the establishment clause is a structural guarantee meant to keep government from mixing itself up with religion; a violation of it infringes on all our rights. If a creche in a public square violates the rights of any nonadherent who sees it, surely this travel ban violates the rights of all Muslims in the United States, whether they are personally subject to it or not.

It is true that the courts have long given the political branches broad latitude on immigration matters. They can draw distinctions based on family ties and national origin that would generate highly skeptical review outside the immigration setting. But that’s because immigration policy inevitably requires the drawing of lines between different family relations, and often involves foreign policy judgments best left to the political branches. But never before has the president sought to inject a religious litmus test into the immigration process. There is simply no good immigration-related reason for the government to depart from the fundamental obligation to remain neutral on religion.

The case may now go to the Supreme Court. But that court has already rejected Trump’s boldest claim, presciently stating, in a case that I argued (and lost), that the government’s “authority and expertise” in national security and foreign relations “do not automatically trump the Court’s own obligation to secure the protection that the Constitution grants to individuals.” At least thus far, the obligation of “so-called” judges to uphold the Constitution has trumped Trump.