Even before Donald Trump entered the White House, many were predicting federal courts would serve as an important check on his use of presidential power, particularly given his aggressive style and a GOP-led Congress that has so far been loath to confront him.
But few expected the first constitutional clash would occur in Trump's third week on the job.
The legal dispute over Trump's executive order — which instituted a temporary ban on arrivals to the U.S. of all refugees and citizens from seven mostly Muslim nations — appears headed to the Supreme Court as early as this week.
The 9th U.S. Circuit Court of Appeals in San Francisco is considering a request from the Justice Department to reinstate the ban after a Seattle federal judge suspended its implementation last week. But both sides are expected to appeal the 9th Circuit decision to the high court.
Fortunately for Trump, the law on immigration and related matters favors the president. Legal precedents have traditionally accorded the chief executive complete and nearly unchecked power to deny foreigners permission to enter the United States.
"The exclusion of aliens is a fundamental act of sovereignty … inherent in the executive power," the Supreme Court said in 1950. And lest there be doubt, Congress adopted a provision in 1952 saying the president "may by proclamation and for such period as he shall deem necessary, suspend the entry of all aliens and any class of aliens as immigrants or non-immigrants" whenever he thinks it "would be detrimental to the interests of the United States."
Typically, legal experts say, the president would almost certainly win a legal fight involving national security and foreign citizens entering the country.
But the rollout of this executive order has been far from the norm. Trump's campaign promise to impose a Muslim ban, his recent tweets attacking the GOP-appointed judge who ruled against him and the White House's clumsy handling of the order's implementation may change the calculation.
"The opinion of this so-called judge, which essentially takes law enforcement away from our country, is ridiculous and will be overturned," Trump tweeted Saturday. "Just cannot believe a judge would put our country in such peril. If something happens blame him and court system," he tweeted Sunday.
Jack Goldsmith, a national security lawyer in the Bush administration and professor at Harvard Law School, predicted Trump's tweets "will certainly backfire" against him.
"The tweets will make it very, very hard for courts in the short term to read immigration and constitutional law, as they normally would, with significant deference to the president's broad delegated powers from Congress and to the president's broad discretion in foreign relations," Goldsmith wrote Monday on the Lawfare blog.
Temple University law professor Peter Spiro agreed the court may look differently at the case. The "path of least resistance would be for the Supreme Court to steer clear of the controversy for now. It could simply refuse to hear an emergency appeal from a 9th Circuit ruling in the case," he said Monday. "Even though the Supreme Court has been extremely deferential to presidential decision-making relating to immigration in the past, I don't think they will be here."
Administration officials have argued that the travel ban does not target Muslims, as critics of the order have claimed. But Trump's campaign call in 2015 for "a total and complete shutdown of Muslims entering the United States" may factor into how judges now interpret his motives.
The highly charged dispute also comes at an awkward moment for the eight justices of a high court that often appears divided along political lines.
Last year, in a similar case involving presidential power, the justices split 4 to 4 and could not decide whether a Texas judge had wrongly blocked an executive action by President Obama that would have given temporary relief from deportation and work permits to more than 4 million immigrants living illegally in the country.
Lawyers for Texas claimed that allowing those immigrants to stay and work would result in costs and real harm to the state. On that basis, a federal judge handed down a nationwide order blocking Obama's plan from taking effect, similar to the nationwide restraining order now blocking Trump's ban.
Obama's lawyers challenged Texas' standing, emphasizing the president's customary power over immigration. But in that case, it appeared the four more conservative justices were concerned the president had exceeded his authority while the liberals took the opposite position. As a result of the tie vote, a lower court ruling that blocked Obama's program remained in effect.
Now, the court may be confronted with similar questions but with the roles reversed: a liberal state challenging the actions of a Republican president.
Lawyers for Washington state went to court in Seattle alleging that Trump's order would cause harm to the state's universities and reduce sale taxes collected from tourists.
On that basis, U.S. District Judge James Robart said the state had legal standing to sue the president. He did not, however, spell out why the ban was illegal or unconstitutional. The state's lawyers had contended the order violated "due process of law" because it changed the rules without warning for foreign travelers, and they said it discriminated based on religion and national origin.
The judge also suggested during a Feb. 3 hearing he was not convinced it was needed to protect national security. He told a Justice Department lawyer defending Trump's action he had to "determine if the executive order is rationally based. And rationally based to me implies that to some extent I have to find it grounded in facts as opposed to fiction."
If the 9th Circuit turns down the administration's appeal and refuses to lift the judge's order, acting Solicitor General Noel Francisco will almost surely turn to the Supreme Court. He argues the state's claim for standing is flimsy, and that the judge had no authority to "second-guess the president's national security judgment."
It would take the vote of five of the eight justices to issue a ruling. Before acting on an emergency appeal, the justices have to weigh the legal and constitutional arguments on both sides and decide who should win, even though they are deciding only on whether to preserve or set aside a temporary restraining order.
If a majority of justices can come to an agreement, it may provide an early indication of whether they think Trump crossed the line.
The court's conservatives are likely to bristle at the notion of a single district judge blocking a president's foreign entry ban because he is not convinced it is needed. Unlike in Obama's case, the Trump administration has portrayed the matter as an issue of national security.
On the same day the judge in Seattle blocked Trump's order, a federal judge in Boston refused a similar request. Judge Nathaniel Gorton said he "declined to encroach upon the delicate policy judgment inherent in immigration decisions."
At the same time, the court's liberal justices are likely to be wary of approving Trump's abrupt change in the rules for foreign travelers. They may prefer for the high court to stand aside, maintaining the status quo for foreign travelers.
Nothing would prevent the Trump administration from stopping suspicious individuals or coming up with new rules or standards for vetting people who want to come to the United States.
No doubt Chief Justice John G. Roberts Jr. would prefer to avoid another 4-4 split, which would only serve to highlight the court's ideological stalemate since the death of Justice Antonin Scalia. If confirmed, Trump's Supreme Court nominee, Judge Neil Gorsuch, would add another conservative to the bench, but he is not expected to be seated until the spring.
In the result of a tie vote, the decision of the 9th Circuit would remain in effect.
In other recent cases, the high court has found ways to avoid a tie vote by deciding matters narrowly or looking for a technical reason to avoid a decision.
For example, last year the court punted on a case involving the contraceptive mandate under the Affordable Care Act as it is applied to religious nonprofits. Rather than settling the dispute, the justices concluded that a compromise could be reached by both sides and sent the matter back to lower courts.
Although the dispute over Trump's order raises a potentially momentous question of president power, the high court is under no obligation to rule broadly now.
On Twitter: DavidGSavage