The Supreme Court’s decision last week in Trump v. Hawaii came at a sensitive moment for the high court—a moment that mixed Trump anxiety with an end of term that frightened and angered many liberals and opponents of the president. Amplifying it all was the retirement of Justice Anthony Kennedy. The travel ban case itself was tailor-made to heighten all of these anxieties. It came down 5-4. And the court deferred to the president—from the perspective of many anti-Trumpers, deferring to him in all his Trumpiness.

The travel ban was, after all, a kind of ur-text of the Trump presidency—or, at least, the original version of it was. It was impulsive, bigoted, chaotic and highly personal in its manifestation of presidential authority and prestige. To have the court affirm it—even a later version that had been much toned down and worked over by executive-branch processes—precisely as a battle royal over the future of the court brewed seemed to many people like a harbinger of the stakes in the struggle for the court.

Trumpism, and President Trump himself, had won a big one. Disfavored religious minorities had lost. And now we will spend the summer reinforcing the majority that handed this president this particular win.

Or so it felt to many shellshocked observers who had hoped to see the court check Trump on this matter.

But Trump v. Hawaii is a court decision, not just a cultural moment. And it’s actually a very hard case. I have spent a lot of time considering it over the past week, and I am still not sure I know the right way for the court to have resolved it.

I am tentatively of the view that none of the justices handled the matter optimally. But I say tentatively because I am not sure I can pinpoint the test the court should have applied. Here are a few preliminary thoughts toward an understanding of the case and the virtues and vices of the both the majority and dissenting opinions.

To understand what Trump v. Hawaii is really about, it’s worth starting with several things that—media coverage, rhetoric and legal argumentation aside—it really is not about.

For starters, the case is not about whether the travel ban in any of its iterations is good policy. Chief Justice John Roberts, writing for the majority, notes that “We express no view of the soundness of the policy.” Normally, when a justice says this sort of thing, it is a kind of boilerplate language meant to emphasize that the court is concerned only with the legality of the action, not its merits as a policy matter. But in this case, there is a hand-washing quality to Roberts’s words as well. Roberts is emphasizing that in upholding the policy, he is not endorsing it. And that is wise. One of the astonishing aspects of the case is that, at least to my knowledge, no serious national security analysts have defended the travel ban on its policy merits. Even the scholars most sympathetic to the administration’s legal defense of the proclamation—like Josh Blackman, for example—take pains not to defend the policy itself. Blackman, for example, writes that, “Despite supporting the travel ban’s legality, I continue to oppose it on policy grounds.”

Indeed, the many former officials of both parties who submitted an amicus brief against the policy—including John Bellinger, Michael Hayden, Avril Haines and Kori Schake, to name only a few of the signatories—may not have persuaded a majority of the court on the law. But they certainly reflect a near-consensus among those who have worked at senior levels in national security policy as to the merits of the idea. This is terrible policy, and everyone knows it. As the former officials put it bluntly in their brief

Amici know of no national security or foreign policy interest that would justify Travel Ban 3.0. Amici include officials who were current on active intelligence concerning credible terrorist threat streams directed against the United States as recently as June 2017, five months after Travel Ban 1.0 was adopted. Yet amici are aware of no specific threat or deficiencies in the current visa vetting system that would justify the complete, country-wide suspensions of travel to the United States prescribed here. Travel Ban 3.0 not only fails to advance the national security or foreign policy interests of the United States, it harms those interests by taking discriminatory actions unprecedented in American history.

I know of neither a serious argument in opposition to this view nor a serious group of national security practitioners or scholars who are seeking to advance one.

This point is important because it wedges the conservative justices in a very tight spot. Deference is easy when you’re deferring to something you agree with. It is moderately easy when you’re deferring to something about which you might have anxieties but that respectable people advance earnestly. It is very hard, however, when you’re asked to defer to a policy for which good arguments are lacking and about which serious people blush before advocating. And it is particularly hard when there is an overlay of invidious motivation for the policy that there is good reason to believe better explains the policy result than either the administration’s stated purpose or the process that ostensibly gave rise to the outcome. This is where the formalism of deference comes to the fore, and it is uncomfortable terrain.

Second, the outcome of this case does not turn on the president’s statutory authority to issue the travel ban under the Immigration and Nationality Act (INA). Many people thought it would be about that. The plaintiffs challenging the ban made a series of arguments that the action violated provisions of the act. And a number of commentators—including Peter Margulies, writing on Lawfare—have advanced similar claims.

Chief Justice Roberts’s opinion for the majority, however, is remarkably strong on the question of the president’s statutory authority. It is notable—striking, really—that none of the dissenting justices chose to contest his statutory argument. Justice Sonia Sotomayor in dissent gives up the ghost on the statutory question quickly, preferring to focus on the First Amendment questions. “Ordinarily,” she writes, “when a case can be decided on purely statutory grounds, we strive to follow ‘a prudential rule of avoiding constitutional questions.’” That rule, however, “is far from categorical and it has limited application where, as here, the constitutional question proves far simpler than the statutory one.”

Thus leaping over the canon of constitutional avoidance to a canon of statutory avoidance, Sotomayor waves away the INA’s broad statutory delegation of power to the president with a blithe, “Whatever the merits of plaintiffs’ complex statutory claims. ...” The other dissent, by Justice Stephen Breyer, barely mentions the statutes at all.

Roberts takes wry note of this abandonment of the statutory field by the dissenters, writing that “The Proclamation is squarely within the scope of Presidential authority under the INA. Indeed, neither dissent even attempts any serious argument to the contrary.” The chief justice’s statutory analysis, which largely tracks Blackman’s writings for Lawfare, declines to acknowledge additional limitations on presidential authority that were not clearly imposed by Congress.

Put these two points together and an interesting picture emerges: The travel ban is dreadful policy, and at least among the justices of the United States Supreme Court, it is not seriously contested that the president has the statutory authority to promulgate it. (Congress could change that, of course, but the case has to be decided under current law.)

Third, the case is not about Korematsu. The discussion of the Japanese internment case by both the majority and dissenting opinions was degrading to the court as an institution and should embarrass both Sotomayor and Roberts. Citing Korematsu is one of the cheapest shots available to a litigant, much less a justice. Sotomayor claims that there are “stark parallels between the reasoning of this case and that of Korematsu.” There are actually not stark comparisons to be drawn, and drawing them is quite beneath her: Ugly as the travel ban is—and I believe it is very ugly—Trump is not rounding up American citizens based on a racial classification and putting them in concentration camps. And this case is not about whether it’s okay for the president to lock people up based on race or whether citizens can be detained in camps without due process; it is actually not about the president’s wartime powers at all; and it thus does not—or shouldn’t anyway—pose the question of whether Korematsu is good law, which, in any event, is not a question that is still contested in our modern jurisprudential disputes.

The dignified response on the part of Roberts and the majority to this drive-by, which represented only two of the justices, would have been muted, a rejection of the claim in a few brief sentences that revealed it for the rhetorical hyperventilation that it was. (It is an interesting question whether Sotomayor’s invocation of Korematsu is one of the reasons Breyer and Justice Elena Kagan did not sign her opinion.) Instead, Roberts responds defensively with Korematsu pieties of his own: I’ll see you’re citing Korematsu, he says, and I’ll raise you an overruling Korematsu! That’ll show her, Mr. Chief Justice. Yet Roberts didn’t actually overrule it in the actual Supreme Court. He merely overruled it “in the court of history.” With the majority seeking approval in the “court of history,” and the dissent seeking approval in the court of public opinion, this clash was little more than competitive moral preening.

So to review the bidding: We have (a) a functional consensus that this is very bad policy, and (b) a functional consensus, at least among the justices, that the president has the authority to promulgate that very bad policy. If we (c) put aside the cheap comparisons to the worst moments in American jurisprudential history, then what is this case really about?

The answer is that the case is about the constitutional status of pretext: When should we accept a pretext from the president, and what does it take to cure or alleviate the taint of bad acts on the part of a president once they have taken place? Are there things that the presidency should normally be allowed to do that Donald Trump might not be allowed to do as president because of the things he has done and said?

That is an extremely hard set of questions.

In different ways, all of the justices acknowledge that they are evaluating how to respond to a pretext. Sotomayor says bluntly that the policy was “first advertised openly and unequivocally as a ‘total and complete shutdown of Muslims entering the United States’” but that “the policy now masquerades behind a façade of national-security concerns.” She denies that this “repackaging” manages to “cleanse” the order “of the appearance of discrimination that the President’s words have created.” And she states that a “reasonable observer would conclude that the Proclamation was motivated by anti-Muslim animus.” Breyer, in his dissent, “would, on balance, find the evidence of antireligious bias ... a sufficient basis to set the Proclamation aside.”

But it isn’t just the dissenters. Justice Anthony Kennedy, while joining Roberts’s majority opinion, acknowledges in an extraordinary paragraph in his separate concurrence that President Trump may not have acted in accordance with his oath of office and that there is reason to doubt the good faith of his action. He writes the following as an abstract observation about life, leaving it for the reader to tie it to the case at hand:

There are numerous instances in which the statements and actions of Government officials are not subject to judicial scrutiny or intervention. That does not mean those officials are free to disregard the Constitution and the rights it proclaims and protects. The oath that all officials take to adhere to the Constitution is not confined to those spheres in which the Judiciary can correct or even comment upon what those officials say or do. Indeed, the very fact that an official may have broad discretion, discretion free from judicial scrutiny, makes it all the more imperative for him or her to adhere to the Constitution and to its meaning and its promise. ... It is an urgent necessity that officials adhere to these constitutional guarantees and mandates in all their actions, even in the sphere of foreign affairs. An anxious world must know that our Government remains committed always to the liberties the Constitution seeks to preserve and protect, so that freedom extends outward, and lasts.

Even Roberts himself, writing for all of the conservative justices, is not free of doubt, though he expresses that doubt carefully. “At the heart of plaintiffs’ case is a series of statements by the President and his advisers,” he writes, “casting doubt on the official objective of the Proclamation.” Roberts is a careful wordsmith, and these words are worth parsing with care approximating the care he likely took in penning them. The chief justice here is not saying that the plaintiffs allege that Trump’s statements cast doubt on the official objective of the proclamation. He is also not saying the statements could be understood to cast such doubt. He says squarely, even in the course of upholding the proclamation, that the statements objectively do cast doubt on the presidential purpose at issue in the case.

In other words, all nine justices conclude either that the stated rationale for the presidential proclamation is a pretext (Sotomayor and Ruth Bader Ginsburg), lean in that direction (Breyer and Kagan), cast public doubt on whether the president of the United States was complying with his oath of office and the Constitution in promulgating it (Kennedy), or—at a minimum—acknowledge that a long series of presidential statements “cast doubt” on the integrity of the administrative record as reflecting the true purpose and reasoning behind the order (all five majority justices).

Roberts’s and Kennedy’s factual concessions on presidential purpose suggest this case is about a little more than what we normally think of as national security deference to the executive. Judicial deference in the national security sphere typically operates for both because the executive has superior competence and information in the conduct of foreign affairs and because courts reason that the function at issue is constitutionally or statutorily assigned to the executive, not the judiciary. The courts thus presume that the constitutionally designated actor, who has sworn an oath to the Constitution, is acting in good faith and is better positioned substantively to make appropriate judgments than are the courts, which are not expert in foreign policy and national security decision making and depend on litigants for the information at their disposal. The specific choice in question, the theory of deference runs, might not be one that the reviewing court would have made—or even agrees with on the merits. But that’s not the point. The court’s job, after all, is not to make the judgment in the first instance but to review it later against some standard of legality.

Merely to describe the normal theory of national security deference makes its application to this situation a little uncomfortable. In this situation, all nine justices acknowledge at least “doubt” as to the “official objectives” of the proclamation. Nor should the analysis start with the assumption that the executive had superior competence. It starts, rather, with the strong suspicion that the process was engineered to justify a preexisting outcome that had its roots in incompetent and bigoted demagoguery. Moreover, one of the justices who chooses to defer acknowledges that the whole oath thing might not be operating properly—and feels the need to remind the president of his oath in a separate concurrence. So the question here is less one of traditional national security deference than one of when, if at all, the court will defer to what it knows or suspects to be a pretext. Should the court defer in the face of suspicions of bad faith? And how clear does the bad faith have to be before the deference ceases to operate?

Making the question harder is the fading taint problem. Travel Ban 3.0 was not the first iteration of Trump’s policy. It was the third, and it followed a significant interagency policy review that took place in the wake of the first two executive orders. Assuming that the first order was indelibly tainted by the president’s bigoted statements, does no amount of time and intervening policy development change the calculation?

Neither Roberts nor Sotomayor proposes an entirely satisfying answer to these questions. For Roberts and the majority, the answer lies in a certain formalism, in which the court evaluates the proclamation as though it were a comparable action by any other president and downplays the relevance of the statements that “cast doubt” on the premise—even while taking note of them. The key words of Roberts’s opinion are these: “the issue before us is not whether to denounce the statements. It is instead the significance of those statements in reviewing a Presidential directive, neutral on its face, addressing a matter within the core of executive responsibility. In doing so, we must consider not only the statements of a particular President, but also the authority of the Presidency itself” (emphasis added).

In this analysis, what matters is not merely the facial neutrality of the proclamation itself—which does not by its terms target Muslims but limits entry from several majority-Muslim countries and two other countries—but also the existence of a significant administrative process undertaken to support it and the apparent seriousness of that process compared with what other presidents have done in support of similar actions. Under this approach, the court doesn’t rely all that much (at least in the national security context) on motive or intent. It looks chiefly at the action itself and the record that supports it. If that action is neutral and plausibly supported by the record, that’s good enough. The rest is politics and policy, which is not the court’s job.

In the current environment, in which commentators are lining up to denounce the court’s decision, it is worth at least pausing over the virtues of this approach, which has the benefit of theoretical and legal coherence and simplicity. The standards the chief justice is urging are judicially manageable and easy to apply. The principles are neutral as well. And they have the benefit of keeping the judiciary out of the business of second-guessing the executive branch’s motives in national security policymaking. This latter point may seem like no virtue at all in a situation in which the executive’s motives very much warrant second-guessing—indeed, where the president himself has shouted from the rooftops that his stated motives are not his real ones. But the value Roberts is protecting here is not trivial. If the court can look behind the stated record for this order, why can’t it look to, say, President Barack Obama’s repeated statements that he had no legal power to help young “Dreamers” before he issued the Deferred Action for Childhood Arrivals (DACA) executive order? Opening the door to this in the national security context would be no small matter.

The problem with Roberts’s approach is that it comes dangerously close to saying, as a matter of judicial doctrine, that in the national security context any pretext will do, as long as the pretext is supported by an adequate administrative record. This latter caveat is actually an important one. The attention Roberts pays to the record and the process that produced it would probably have doomed both of the first two iterations of the travel ban, neither of which had any sort of process behind them. That’s no small thing, and it shouldn’t go unnoticed that the Supreme Court majority, in upholding Travel Ban 3.0, did so using a legal test that Trump’s earlier actions probably would not have passed. So perhaps Roberts’s formalism has more teeth than I am giving it credit for.

But Roberts’s solicitude for pretext, even conceding that his standard is not without substance, troubles me. To understand why, consider a hypothetical presidential statement that is only a little more extreme than ones Trump actually made. Imagine that at some press conference, or in some tweet, Trump had baldly declared: All that stuff in the record is just stuff the lawyers had to say. I promised a Muslim ban, and I delivered. As I read Roberts’s opinion, a statement of this type—that is, one explicitly flagging that the administrative record is a ruse—would not have changed the court’s holding. The record would still be neutral as to religion, after all. The process supporting it would still be what Roberts termed “a worldwide review process undertaken by multiple Cabinet officials and their agencies.” Under Roberts’s standard, even if the president boasted repeatedly that he was using a pretext to fool the justices, it’s not clear to me why the court should not defer to the process, rather than listen to the candor.

Note that this hypothetical is not all that far from reality—both because of the sheer volume of President Trump’s statements as to his real motives and because of the frankness of many of them. Upholding an order under such circumstances—in which the record is all but acknowledged as a pretext and the jurisprudential approach would tolerate an even more obvious pretext—has risks for the court. One is the risk of appearing naive. Sotomayor repeatedly accuses the majority of blinding itself to the reality of what Trump is doing and allowing the president to “hide behind an administrative review process that the Government refuses to disclose to the public.” She describes the review process as “window dressing” and the majority’s acceptance of it as “blind[ness].”

Sotomayor is not wrong. And a doctrine that permits a pretext quite this naked rightly exposes the court to accusations of getting played. Consider: How will Roberts and the majority look when Trump, as he very likely will at some point, once again declares this policy a fulfillment of his campaign promise to stop Muslims from entering the country? It will sound more than a little silly at that point to intone that there was this full administrative record and worldwide review and an interagency process supporting it.

Sotomayor and the dissenters will have a one-syllable reaction to that news: “Duh!”

And, to be sure, Sotomayor has an easy response to the pretext problem, one that has the virtue of realism. Her dissent starts with a catalogue of the president’s statements, treating the relevant record as everything he said on the campaign trail, in office and in connection with the prior iterations of the travel ban. Thus laid out, the record leaves little room for doubt either that the president harbors bigoted anti-Muslim sentiments or that those were at play, at least to some degree, in the promulgation of the sequence of executive orders. In the mind of the concerned citizen not fixated on jurisprudential niceties, as opposed to the jurist who must observe them, it will leave little doubt that this animus was a driving factor—particularly since there is so little other policy justification for the order. And this leads naturally enough to Sotomayor’s bottom line: “The full record paints a far more harrowing picture, from which a reasonable observer would readily conclude that the Proclamation was motivated by hostility and animus toward the Muslim faith.”

But “Duh!” is not a jurisprudential standard. And Sotomayor’s opinion has problems, most importantly that it lacks anything resembling a limiting principle. A justice who wishes to look beyond the record advanced in support of a presidential order, to look to statements made around prior iterations of the policy in previous administrative records, to look to a president’s pre-inaugural statements on the policy subject as evidence of his intent in promulgating the policy incurs, at least in my opinion, some burden to say what the president needs to do to erase the taint of prior statements. After all, Trump could be president for a long time to come. Is any policy he makes affecting any entry from any majority-Muslim country forever tainted before the courts with a presumption of bias as a result of his string of bigoted statements about Islam? What if he had made only one bigoted statement, and it was a long time ago, and the connection to the current policy were less clear?

Sotomayor does not even pause over such questions. So while she rightly calls out the president’s pretext, calling a spade a spade doesn’t help one define a spade. And she offers no guidance at all as to how we are to know when deference drifts into pretext.

The result is that her opinion, were it actually law, would be an exceedingly blunt instrument. Under her logic, I can see no reason why, say, five years from now and assuming Trump gets reelected, a court could not consider his campaign statements from 2015 if he were to, say, temporarily limit entry—even modestly—from a Muslim country of particular concern after a string of terrorist attacks emanating from that country’s soil. The comments, after all, would still be bigoted. The hostility would still be there. And while Trump could put together a facially neutral record to support the action, he can do that now too. In fact, he did. Under her logic, the problem is Trump and the things he personally has said and apparently believes. I have a lot of emotional sympathy for this approach, but I am constrained to say that it is not a principle a court can reasonably apply. And it is not a sound basis for the judiciary to interact with a coordinate branch of government—even if the president is Donald J. Trump.

In the end, the opinion I wanted to read—from any justice, whether conservative or liberal—was one that both candidly acknowledged the record in this case as an unacceptable pretext and advanced a clear test for distinguishing pretext from good-faith circumstances in which deference is appropriate. None of the justices endeavored to write that decision. It’s hard to blame them. I can’t pinpoint a reasonable test for pretext either, particularly not in the national security context. But I’m also not comfortable saying, with Roberts, that any pretext supported by a facially neutral record will do, or saying, with Sotomayor, that I know a pretext when I see it—and that the stain of pretext taints a president forever.

The issue of pretext is not going away. The nature of Donald Trump is that he does and says outrageous things that his administration then has to find rationales to support. Trump v. Hawaii does not resolve the question of domestic pretext on non-national-security matters. It doesn’t even resolve the question of this case. The decision, after all, covers only the question of whether the lower courts properly issued a preliminary injunction against enforcement of the proclamation. Plaintiffs will likely seek discovery and continue pressing their claims.

So one way or another, the question will be back. As long as Trump is president, the issue of pretext will haunt the court. I suspect that Trump, merely by being himself, will make traditional formalistic deference an increasingly precarious ledge for the court to stand on.