The longest government shutdown in American history is over. Thank goodness.

But the war over President Trump's border wall isn't finished, no matter how defeated he seems. That much should be clear from the president's defiant tweets over the weekend. Instead, it's likely that the biggest and most important battles — battles that could determine the future of the U.S. constitutional order — are yet to come.

Mick Mulvaney, Trump's acting chief of staff, made that clear Sunday, saying on Fox News: "The president's commitment is to defend the nation, and he will do it either with or without Congress."

Almost certainly it will be without Congress, despite Trump's assertions that rank-and-file Democrats are ready to jump ship and vote for wall funding if they get the right deal. That's probably not true. It's probably also not true that Trump is ready to shut down the government a second time over this issue — given how badly the recent shutdown affected his standing in the polls, a second closure of government would defy everything we know about Trump's instinct for survival. Instead, it seems increasingly likely that Trump will declare a national emergency and assert his right to appropriate funding for the project regardless of legislative branch assent. The Washington Post reported on Sunday the president is telling advisers "that declaring a national emergency may be his best option now."

The Constitution, after all, explicitly grants Congress the power of the purse. If the president declares an emergency, it seems like it should be a relatively simple thing for congressional leaders to take Trump to court — a familiar environment for him — and have his action declared null and void. Otherwise, we live in an authoritarian state. End of story, right?

Maybe not.

As Elizabeth Goitein points out at The Atlantic, Congress has handed a lot of its potential authority to the president over the decades, in legislation meant to let the executive branch move quickly if the nation ever does enter a state of emergency. The result is that "this legal regime for emergencies — ambiguous constitutional limits combined with a rich well of statutory emergency powers — would seem to provide the ingredients for a dangerous encroachment on American civil liberties."

It also allows encroachment upon legislative authority. Congress — not the president — possesses the power to tax, yet Trump has waged his trade wars against China, Canada, and other nations with tariffs he's allowed to impose thanks to those emergency powers. Republicans in Congress have hated those tariffs — but they've mostly deferred to the president.

We can probably expect the House of Representatives, led by Speaker Nancy Pelosi (D-Calif.), to be a bit more aggressive in asserting its authorities. (Indeed, that's already happened.) If Trump declares an emergency in order to fund the wall, you can expect the House to sue.

What would the courts do? That's harder to predict. We do know that Trump and the GOP-held Senate have spent the last two years filling the federal courts with as many conservative judges as they can possibly get appointed. We also know that Trump expects his appointees to show him some personal loyalty. That doesn't mean they will, obviously, but it does mean the courts might be more of a wild card in deciding the matter than a simple reading of the Constitution would suggest.

This moment has seemed likely for some time. Trump's authoritarian instincts are apparent, so it was always the case we'd reach a point in his presidency at which he would be tempted to make Congress officially irrelevant. As my colleague Matthew Walther pointed out a few weeks ago, declaring an emergency allows Trump to save face and move on from the issue — after all, deferring final judgment to the courts could take months or years.

Declaring an emergency and dumping the issue on the courts will feel better than a shutdown — no missed paychecks, no airport slowdowns — but it might be actually worse for the Constitution. If the courts should somehow rule in Trump's favor — the meager limits restraining his presidency, or any American presidency — will be greatly loosened.

Trump's fans are fine with that. They are short-sighted — and should consider if they're ready to let Democratic presidents have the same power they want Trump to assert. Is it so difficult to imagine, say, a President Elizabeth Warren declaring that Medicare-for-all is necessary to American national security? Or any president using the powers for far worse reasons and to far worse effect?

Trump's opponents spent much of the weekend exulting in the president's capitulation on the shutdown. You can't blame them. But there's a longer game being played here. The war over the wall has just begun.