The case marks the first of Mr. Trump’s major policies to squarely reach the justices, and analysts said their ruling will set the tone for how much deference courts give the unorthodox president for the rest of his tenure.
Immigrant rights activists, congressional Democrats and much of the rest of the anti-Trump resistance had been looking to the justices to block Mr. Trump. With Congress controlled by Republicans, they said, it is up to courts to constrain the president.
Some of the court’s liberal justices were inclined to agree, but they appeared to be outmatched by the Republican-appointed justices who defended the president’s powers and discounted lower courts’ findings of anti-Muslim “animus.”
“If you look at what was done, it does not look at all like a Muslim ban,” declared Justice Samuel A. Alito Jr.
Solicitor General Noel Francisco, arguing the case for Mr. Trump, agreed.
“If it were, it would be the most ineffective Muslim ban that one could possibly imagine,” he said, pointing out that Mr. Trump’s policy doesn’t cover 45 of the world’s 50 majority-Muslim countries.
Neal Katyal, a former top litigator for the Obama administration who represented the state of Hawaii, Mr. Trump’s opponent in the case, said it wasn’t how many Muslims were left out that mattered, but how many were included. He said up to 99 percent of those affected by the travel ban are Muslims.
Even still, he said, Mr. Trump’s plans could be legal — had he not left such an extensive record of disparaging comments about Muslims that taint everything he has done in this area. “We wouldn’t be here if it weren’t for all the different statements,” Mr. Katyal told the court.
The policy before the court Wednesday is the third version of the travel ban.
Mr. Trump’s original order, issued a week after he took office, was a broad ban on entry from seven majority-Muslim countries identified by Congress and the Obama administration as posing a special danger in terms of travel. That was quickly blocked by the courts.
The president responded months later with a second version that reduced the list to six countries — Iraq was removed — and expanded waivers allowing more people from targeted countries to enter. Lower courts blocked that version, but the justices allowed it to go into partial effect.
Last fall, Mr. Trump announced his third attempt after a global review by his top aides examined other countries’ ability to track their own citizens and willingness to cooperate on identifying them when they try to enter the U.S.
That list included Chad, Iran, Libya, North Korea, Somalia, Syria, Venezuela and Yemen. Six of those eight were majority-Muslim, and North Korea and Venezuela were the exceptions. Chad was dropped from the list after its leaders stepped up their information-sharing, leaving the list with seven countries — five majority-Muslim.
Lower courts still said it was illegal, with some judges questioning the president’s legal powers and others saying he was still tainted by anti-Muslim “animus” from the campaign.
Both arguments got time Wednesday.
Mr. Francisco told the justices that Congress has granted the president broad powers to block entry of anyone he deems a threat. In that respect, he said, Mr. Trump’s ban is broader but fundamentally no different from a Carter administration ban on Iranians or a Reagan administration ban on Cubans.
That claim resonated with Justice Anthony M. Kennedy, a Republican appointee and frequent swing vote. Mr. Trump’s opponents had hoped to win him over.
He said Mr. Trump’s policy compared favorably with the Carter and Reagan proclamations and offered more detail behind the decision-making.
“This is the most detailed proclamation ever issued in American history,” Mr. Francisco confirmed.
Justice Kennedy was also skeptical of Mr. Katyal’s demand that the judges play referee on a president’s national security decisions.
Justice Elena Kagan, a Democratic appointee to the court, asked the most probing questions of either side, testing the expanse and limits of presidential powers.
She drew laughter when she pondered a hypothetical “out-of-the-box kind of president” who might have deep animus toward a particular group.
She acknowledged that it would be tough to know what he really believed but suggested that he be judged based on what “reasonable observers” would be led to think based on his words.
Mr. Francisco said that could be a problem in other cases, but in this case the worldwide review conducted by Mr. Trump’s Cabinet and the recommendations that led to the travel ban prove it’s legitimate.
Justice Sonia Sotomayor, though, doubted the thoroughness of the Trump Cabinet’s review and wondered about a president who ordered his team to reach a specific conclusion: “They’ve been told what the outcome of their deliberations must be.”
She seemed to be hinting at issues beyond the travel ban, questioning what duties a president’s team has under the “unitary executive” theory of presidential power.
Mr. Francisco said they must be prepared to defy the president if that were the case.
“The president’s Cabinet, just like all of us here, is duty-bound to protect and defend the Constitution.
So I would expect that if any Cabinet member were given that order, that Cabinet member would refuse to comply, or resign, the face of a plainly unconstitutional order,” the solicitor general said.
“Here, however, you don’t have anything like that,” he said. “Rather, you have the Cabinet doing its job through the agencies. … They concluded that the vast majority of the world, including the vast majority of the Muslim world, was just fine, but there were problems with a small number of countries and so imposed pressure, recommended pressure, to help move those countries across the line.”
Mr. Katyal said Mr. Trump could have avoided problems with his policy if he had recanted his statements about Muslims.
“I think the president could have easily moved away from all of these statements, you know, but instead they embraced them. That’s the difference,” he told Chief Justice John G. Roberts Jr.
Mr. Francisco said the president is cleansed once he takes office and begins getting advice from his Cabinet. “That oath marks a fundamental transformation,” he said.
The travel ban case, formally known as Trump v. Hawaii, was the final one to be argued in person before the justices for this term. A decision is expected at the end of June.