David Cole is national legal director of the ACLU, which along with the National Immigration Law Center is representing the plaintiffs in the Maryland case challenging the travel ban.

Should courts look behind the four corners of President Trump’s second executive order temporarily banning entry from a group of Muslim-majority countries in assessing its legality? The constitutionality of the order turns on the answer.

Both federal judges who have enjoined the order — Derrick Watson in Hawaii and Theodore D. Chuang in Maryland — concluded that it was appropriate to consider statements of Trump and his surrogates, and that those statements, made both before and after inauguration, doomed the order by showing that it was designed to target Muslims. But the Trump administration insists that judges cannot consider the purpose of those who drafted and promulgated the order. Last week, several conservative judges on the U.S. Court of Appeals for the 9th Circuit , dissenting from that court’s refusal to reconsider its decision invalidating the first travel ban, backed the Trump administration’s view. Who is right?

The issue is central because the executive order itself does not expressly cite Islam as a justification, but Trump and his aides and advisers could not have been clearer that the order is designed to effectuate the Muslim ban that Trump repeatedly promised during the campaign and after. If one looks only at the order, the government argues, it must be upheld, because it bars entry not of Muslims as such, but only of the nationals of six countries whose populations just happen to be between 90.7 percent and 99.8 percent Muslim. The government does not even try to argue that the order can survive an establishment-clause challenge if one considers the statements of Trump and his agents, and the history of its adoption.

The question is made difficult by the fact that there are two apparently contradictory lines of relevant judicial precedent that have never yet met. On the one hand, the court’s establishment-clause jurisprudence provides that the validity of a government action turns on its purpose, which is determined by whether a reasonable observer, aware of all the relevant facts and circumstances, would deem the government to be targeting a specific religion. Even formally neutral laws are invalid if context makes clear that they are aimed to favor or disfavor a particular religion. Accordingly, the court has directed that judges must not “turn a blind eye to the context in which [the] policy arose,” and has considered statements made in town hearings, and the manner in which laws have been adopted and implemented — evidence outside the text of a law or order itself.

In immigration, however, the government argues that as long as the order is “facially legitimate and bona fide,” it cannot be struck down, regardless of the surrounding circumstances. The Supreme Court has applied that deferential standard to U.S. citizens’ challenges to the exclusion of a communist economist, Ernest Mandel, who had violated the terms of his visa on an earlier visit, and to a law providing different immigration benefits to foreign children of unwed U.S. citizen mothers than to the foreign children of unwed U.S. citizen fathers.

The Trump administration says these cases mean the courts can never look behind an immigration executive order. On this theory, the courts would have to uphold the executive order even if Trump, upon signing it, had announced, “I do this to make crystal clear that Christianity is America’s official religion, and that Islam has no place here.”

That cannot be right. The establishment clause demands that the government remain neutral as between religious denominations, and makes no exception for border control . If it violates the establishment clause to put up the Ten Commandments in a courthouse because doing so impermissibly mixes politics and religion and makes non-adherents feel marginalized, surely a national immigration policy designed to bar Muslims does as well. And the effect of the government’s action hinges on more than the four corners of a document, but on its purpose, which must be and always has been gleaned from the surrounding circumstances.

So does the immigration or the establishment-clause test govern? The answer should depend on the nature of the government’s action. Deference is proper when the political branches draw customary and “bona fide” immigration lines, especially when there is no suggestion of an improper purpose. It makes sense to defer to immigration decisions based on family ties or adherence to visa conditions, because it is next to impossible to regulate immigration without drawing such lines. But the Trump administration has advanced no reason immigration law should be a tool for denigrating religion.

Establishing religion has never been a proper goal of immigration law — or any law. Targeting Islam violates the rights of Americans, whatever form it takes; there is no justification for giving the government a pass because it is regulating the border. When Trump signed the first travel ban, he said, “We all know what that means.” We do, indeed. And judges, no less than the rest of us, must not blind themselves to what “we all know.”