A US appeals court questioned whether Donald Trump's travel and immigration ban is intentionally discriminatory against Muslims, as the the president's most controversial order faced its biggest legal test on Tuesday night.

Three judges at the appeals court in San Francisco have been charged with deliberating on whether a restraining order issued by a lower court should remain in effect while a challenge to the ban proceeds.

Opponents of the ban argued that Mr Trump's decision had "unleashed chaos" at airports in America and around the world, as thousands – including green card holders – found themselves banned from boarding their planes or detained on arrival.

They also argued that it was intentionally discriminatory against Muslims. But 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 percent 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."

The justice department also countered to the panel of judges that the president alone has the power to decide who can enter or remain in the United States.