SAN FRANCISCO -- President Donald Trump's travel ban faced its toughest test yet Tuesday as a panel of appeals court judges hammered away at the administration's claim that the ban was motivated by terrorism fears while also directing pointed questions to an attorney challenging the executive order on grounds that it unconstitutionally targeted Muslims.

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 judges also jumped into the larger constitutional questions surrounding Trump's order, which temporarily suspended the nation's refugee program and immigration from seven mostly Muslim countries that have raised terrorism concerns.

The hearing was conducted by phone -- an unusual step -- and broadcast live on cable networks, newspaper websites and various social media outlets. It attracted a huge audience, with more than 130,000 alone tuned in to the court's YouTube site to hear audio.

A decision by the 9th Circuit was likely to come later this week, court spokesman David Madden said.

Judge Richard Clifton, a George W. Bush nominee, asked an attorney representing Washington state and Minnesota what evidence he had that the ban was motivated by religion. The two states are suing to invalidate the ban.

"I have trouble understanding why we're supposed to infer religious animus when in fact the vast majority of Muslims would not be affected."

Only 15 per cent of the world's Muslims are 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 Trump calling for a ban on the entry of Muslims to the U.S. He said the states did not have to show every Muslim is harmed, only that the ban was motivated by religious discrimination.

Clifton also went after the government's attorney, asking whether he denied statements by Trump and former New York City Mayor Rudolph Giuliani, who said recently that Trump asked him to create a plan for a Muslim ban. Judge Michelle T. Friedland, who was appointed by President Barack Obama, asked why the case should not move forward to determine what motivated the 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 Justice Department.

Under questioning from Clifton, Flentje did not dispute that Trump and Giuliani made the statements.

Clifton said he understood if the government argued that statements by Trump and his advisers should not be given much weight, but he said they are potentially evidence in the case.

Friedland also asked whether the government has any evidence connecting the seven nations to terrorism.

Flentje told the judges that the case was moving fast and the government had not yet included evidence to support the ban. Flentje cited a number of Somalis in the U.S. who, he said, had been connected to the al-Shabab terrorist group.

The ban has upended travel to the U.S. for more than a week and tested the new administration's use of executive power.

Whatever the court eventually decides, either side could ask the Supreme Court to intervene.

The government asked the appeals court to restore Trump's order, saying that the president alone has the power to decide who can enter or stay in the United States. Several states insist that it is unconstitutional.

Flentje offered the 9th Circuit a third option, saying the court could exempt from the ban people who have previously been admitted to the U.S., but keep it in place for people who have never been to the country.

The judges repeatedly questioned 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 faculty getting stranded overseas.

Purcell said that restraining order has not harmed the U.S. government. Instead, he told the panel, 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.

Trump said 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," Trump 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 lawmakers that the order probably should 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. Or the administration could change it in any number of ways that would keep the issue alive.

------

Associated Press writers Brian Melley in Los Angeles and Eugene Johnson in Seattle contributed to this report.