He ran smack into the limits of executive power.
Three federal judges unanimously refused to restore the White House's controversial travel ban, laying down the most significant marker yet that Trump's vision of an administration rooted in the muscular use of executive power -- similar to that he enjoyed as a business leader -- will not go unchallenged.
The tone and content of the decision immediately called into question Trump's gamble in enacting such a fundamental reshaping of the nation's immigration laws through presidential order rather than a law debated and passed by Congress.
And he might not be done yet. Asked if Trump was considering signing a new immigration executive order in the wake of the court's decision, a White House official said Friday that he hasn't ruled anything out.
"Nothing's off the table," the official said.
The embarrassment of Thursday's ruling raises new doubts about the effectiveness of the President's unorthodox method of doing business. In this case, the tendency to draw up plans without much outside input has not served the White House well. The relative inexperience of Trump's core advisers may also have been a factor.
It is now certain that the saga of the immigration ban, which has consumed the presidency for two of its three weeks and is distracting from other priorities, will run on indefinitely with possible damaging consequences for the young administration.
But the President, who came to office predicting an avalanche of wins and warning that only he could fix the multiple crises he diagnosed as ailing the national soul, is a long way from admitting a final defeat. Drawing on the pugilistic instincts that sustained his business career, he dug in for a counter attack.
"SEE YOU IN COURT," Trump tweeted minutes after the ruling came down, previewing a possible appeal to the Supreme Court that would set up an even more dramatic and consequential showdown.
A few minutes later, the President began the task of using the decision to galvanize his devoted armies of supporters who sent him to Washington to carry out reforms exactly on the lines of his original executive order.
"It's a political decision, we're going to see them in court, and I look forward to doing that," Trump told reporters at the White House. "We have a situation where the security of our country is at stake and it's a very very serious situation."
The ruling came with Trump waging feuds on multiple fronts with various lawmakers on Capitol Hill and with his own approval ratings at lower levels than ever seen for a newly inaugurated president.
Democratic opponents hailed the decision as an affirmation of the principles on which the nation is based and a precursor of likely pitched legal battles to come on the extent of Trump's power.
'Check and balance'
"I am pleased that our check and balance system is working in this country," Ben Cardin, the top Democrat on the Senate Foreign Relations Committee, told CNN's Wolf Blitzer. "It shows that the courts are going to be there when President Trump uses his power and exceeds his constitutional authority. I think that is an important message that our constitutional system will work."
But the President's allies quickly moved to contain the damage and to frame the terms of the political and legal fight ahead.
Arkansas GOP Sen. Tom Cotton said the order was plainly legal and argued the courts shouldn't second guess the national security decisions of the president.
"This misguided ruling is from the Ninth Circuit, the most notoriously left-wing court in America and the most reversed court at the Supreme Court," Cotton said. "I'm confident the administration's position will ultimately prevail."
The Supreme Court could still rule in favor of the administration, either on the merits of the case or the issue of standing of foreigners on whose behalf the challenge to Trump's executive order was brought by the state of Washington.
But the possibility of the nation's highest bench being called upon to clear up a growing legal imbroglio will also open a new political fight. The Supreme Court is currently lacking its ninth member owing to the prolonged Washington standoff following the death last year of Justice Antonin Scalia.
Should the Court hear the case and split 4-4, the ruling of the 9th Circuit would be affirmed. That fact alone adds heat to the confirmation duel looming over the nomination of Trump's first Supreme Court pick, Neil Gorsuch.
Republicans now have even more of an incentive to ram the confirmation through the Senate using the "nuclear option" to sidestep a Democratic filibuster. Democrats are even less likely to cooperate with a swift process.
The 9th Circuit decision, however, seemed designed to shape the future arguments about the content of the executive order and the administration's attempts to significantly stiffen the government's anti-terrorism campaign.
It went far further in its ruling than the simple question of the stay on the travel ban imposed by a lower court, taking pains to dismantle the administration's assertion that the travel ban was vital to protecting Americans against an influx of foreign terror threats from the seven named nations, Iran, Iraq, Somalia, Sudan, Yemen, Libya and Syria.
"The Government has pointed to no evidence that any alien from any of the countries named in the Order has perpetrated a terrorist attack in the United States," the ruling said.
"Rather than present evidence to explain the need for the Executive Order, the Government has taken the position that we must not review its decision at all."
The stinging ruling presented the President with several options
, including an immediate appeal to the Supreme Court.
Trump also has the option of going back to the drawing board and coming up with a new way to impose "extreme vetting" restrictions he says are necessary.
But it seems certain he will not take the route since to do so would involve not only admitting the bitter taste of a high stakes legal defeat but repudiating the combative win-at-all-costs attitude that animates his character.
"The President has lost so he is now in a state of limbo. For weeks perhaps even months his order is going to be stayed," Alan Dershowitz, professor emeritus at Harvard Law School, told CNN's Erin Burnett. "He claims that this is a threat to the national security of the United States. If he is right, then he has only one option -- rescind the order, start from scratch ... write a new order that will both protect the security of the United States and avoid constitutional challenge."
Dershowitz added: "But it would require him to admit that he is wrong. So now there is a clash between the ego of the President and the national security of the United States."