President Trump’s declaration of a national emergency at the southern border to build a wall there is nearly unprecedented in American history and will end in a showdown at the Supreme Court. A lawsuit will certainly be filed to stay Trump’s order and it will quickly work its way to the highest court in the land.

And then it could go either way.

If the court’s four liberals and four conservatives vote as expected, the case will depend on Chief Justice John Roberts. And his record on executive power and the rule of law is decidedly mixed.

Just last year, Roberts wrote the controversial 5-4 decision allowing Trump’s “Muslim ban” (rebranded as a “travel ban”) to go into full effect. Despite Trump’s numerous promises of a “total and complete shutdown of Muslims entering the United States,” Roberts took the State Department at its word when it said the ban was about national security, not religion.

In many ways, the border wall is similar. Yes, the president spending money in a way Congress expressly refused to do is a clear violation of Article I of the Constitution. But the president has broad power when it comes to national security; if he can ban Muslims from visiting America, he can build a wall in Texas to stop Central Americans.

(Trump’s offhand remark that “I didn't need to do this” doesn't mean there isn’t an emergency. The case for an emergency will be based on a long, factual record, not a single ambiguous phrase.)

“ This is a case in which Congress has clearly said ‘no’ and the president says ‘yes’ anyway. ”

On the other hand, Roberts took the nearly unprecedented step of publicly rebuking Trump for criticizing “Obama judges” when the president lost in court, declaring “we do not have Obama judges or Trump judges, Bush judges or Clinton judges. What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them.”

In addition, Roberts has, in numerous cases, sought to re-establish the Court’s legitimacy in the wake of a string of horrible, political, and legitimacy-reducing decisions, most importantly Bush v. Gore, in which conservative justices junked both federalism and originalism to interpret Florida’s constitution in favor of George W. Bush.

Most famously, Roberts twice saved the Affordable Care Act from Republican-led lawsuits against it, establishing his own independence as well as that of the Supreme Court.

So, which Roberts will it be? The one who defers to the president and defies common sense, or the one who stands up for the rule of law against a president with no respect for it?

As a matter of law, Trump is clearly on the losing side of Supreme Court precedent.

The president’s constitutional powers in the case of emergencies are very limited; they extend only to suspending writs of habeas corpus. The National Emergencies Act, passed in 1976, provides very broad authority to declare a national emergency and act in the case of one.

Since its passage, 58 such emergencies have been declared, and 31 of them are still in effect today. Three were declared, uncontroversially, by Trump himself.

However, most emergency actions have been economic (boycotts of Syria, Iraq, Zimbabwe, and numerous other countries) or seizures of individual property. None is of the scale of the border wall.

More importantly, none of those actions has gone against the express will of Congress, which was the subject of one of the most famous Supreme Court cases in legal history, Youngstown Sheet & Tube Co. v. Sawyer.

In 1952, after President Truman used emergency powers during the Korean War to seize steel mills in the face of a strike, fearing that national security would be at risk if they closed. In Youngstown, which came to be known as the “Steel Seizure Case,” a divided Supreme Court—there were eight separate opinions—held that when Congress had specifically refused to take a specific action, as they had in the steel seizure case, the president lacked authority to do so.

The border wall is an even stronger case than Youngstown. In Youngstown, Congress had merely failed to act. Here, Congress has expressly refused to do so.

Congress has had many years to build such a barrier, and it has built 658 miles of one. But it has declined, again and again, to build a 1,000-mile barrier or to appropriate almost any money for the Trump administration to do so. The recent government shutdown, of course, was precisely about that disagreement.

In other words, this is not a case in which Congress has been silent, as in Youngstown. This is a case in which Congress has clearly said “no” and the president says “yes” anyway.

Thus, the National Emergency Act, as applied in this case, would seem to violate the Constitution’s separation of powers. Congress didn’t write into the law the power to defy it at will; on the contrary, it was written to limit presidential power in the wake of Watergate.

Not only are Trump’s actions unconstitutional under Youngstown; arguably, Trump’s defiance of Congress is at the essence of constitutional democracy itself. It is the difference between a republic and fascism.

These are the questions for the Supreme Court to decide.

In the meantime, the immediate future of the wall is not yet clear. A lawsuit will certainly include a request for an injunction barring construction while the litigation unfolds. That request may or may not be granted; the standard for an injunction is higher than the standard for deciding the case itself. The bulldozers could start building Trump’s wall before the Supreme Court rules on its legality.

At the end of the day, however, this will be the Supreme Court’s decision to make. The Trump-Roberts showdown is here, and at stake is the Constitution itself.