Donald Trump's travel ban has faced its toughest test yet, with a panel of appeal court judges hammering the US government's arguments that it was motivated by terrorism fears.
But the judges also directed pointed questions to a lawyer who claimed the ban targeted Muslims unconstitutionally.
The contentious hearing before three judges on the San Francisco-based 9th Circuit Court of Appeals focused narrowly on whether a restraining order issued by a lower court should remain in effect while a challenge to the ban proceeds.
But the panel also jumped into the larger constitutional questions surrounding President Trump's order, which temporarily suspended the nation's refugee programme and immigration from seven mostly-Muslim countries that have raised terrorism concerns.
In an unusual step, the hearing was conducted by phone and broadcast live from the court's website to a record audience.
Judge Richard Clifton, a George Bush nominee, asked a lawyer representing Washington state and Minnesota, which are challenging the ban, what evidence he had that the ban was motivated by religion.
"I have trouble understanding why we're supposed to infer religious animus when in fact the vast majority of Muslims would not be affected," he said.
Only 15% of the world's Muslims were affected, the judge said, citing his own calculations.
He added that the "concern for terrorism from those connected to radical Islamic sects is hard to deny".
Noah Purcell, Washington state's solicitor general, cited public statements by Mr Trump calling for a ban on the entry of Muslims to the US.
He said the states did not have to show every Muslim was harmed, only that the ban was motivated by religious discrimination.
Judge Clifton also went after the government's lawyer, asking whether he denied statements by Mr Trump and former New York City mayor Rudolph Giuliani, who said recently that Mr Trump asked him to create a plan for a Muslim ban.
"We're not saying the case shouldn't proceed, but we are saying that it is extraordinary for a court to enjoin the president's national security decision based on some newspaper articles," said August Flentje, who argued the case for the US Justice Department.
Under questioning from Judge Clifton, Mr Flentje did not dispute that Mr Trump and Mr Giuliani made the statements.
Judge Michelle Friedland, who was appointed by Barack Obama, asked whether the government had any evidence connecting the seven nations to terrorism.
Mr Flentje told the judges that the case was moving fast and the government had not yet included evidence to support the ban.
He cited a number of Somalis in the US who he said had been connected to the al-Shabab terrorist group.
The ban has upended travel to the US for more than a week and tested the new administration's use of executive power.
The live broadcast of the oral arguments on the court's YouTube site had 137,000 connections, by far the largest audience for an oral argument since the 9th Circuit began live streaming about two years ago, said David Madden, a spokesman for the court.
Some news outlets also carried the live stream.
Whatever the court eventually decides, either side could ask the Supreme Court to intervene.
The government asked the appeal court to restore Mr Trump's order, saying that the president alone had the power to decide who could enter or stay in the United States.
Several states insist that it is unconstitutional.
The judges repeatedly questioned Mr Flentje on why the states should not be able to sue on behalf of their residents or on behalf of their universities, which have complained about students and staff being stranded overseas.
Mr Purcell said that restraining order had not harmed the US government; instead, he told the panel, Mr Trump's order had harmed Washington state residents by splitting up families, holding up students trying to travel for their studies and preventing people from visiting family abroad.
A decision by the 9th Circuit was likely to come later this week, Mr Madden said.
Mr Trump said on Tuesday that he cannot believe his administration has to fight in the courts to uphold his ban, a policy he says will protect the country.
"And a lot of people agree with us, believe me," he said at a round-table discussion with members of the National Sheriff's Association.
"If those people ever protested, you'd see a real protest.
"But they want to see our borders secure and our country secure."
Homeland Security secretary John Kelly told politicians that the order should probably have been delayed at least long enough to brief Congress about it.
If the case does end up before the Supreme Court, it could prove difficult to find the necessary five votes to undo a lower court order.
The Supreme Court has been at less than full strength since Justice Antonin Scalia's death a year ago.
The last immigration case that reached the justices ended in a 4-4 tie.
How and when a case might get to the Supreme Court is unclear.
The travel ban itself is to expire in 90 days, meaning it could run its course before a higher court takes up the issue.
Alternatively, the administration could change it in any number of ways that would keep the issue alive.