Federal appeals court judges peppered a US Justice Department lawyer with tough questions about President Donald Trump's ban on travellers from six Muslim-majority nations, during a hearing that marks the start of the crucial next stage in the legal battle over the measure.

Three Republican appointees on the Richmond, Virginia-based 4th US Circuit Court of Appeals signalled sympathy with Mr Trump's travel ban during arguments before 13 judges, but several of the judges voiced scepticism that protecting national security was the main aim of the policy, and not religious bias..

Six Democratic appointees on a court dominated by judges named by Democratic presidents seemed concerned about reviving the Republican president's 6 March executive order that prohibited new visas to enter the United States for citizens of Iran, Libya, Somalia, Sudan, Syria and Yemen for three months in the administration's appeal of a lower court ruling blocking it.

Based on the questions asked during the argument, a ruling could hinge on whether the appeals court agrees with a lower court judge that past statements by Mr Trump about the need to prevent Muslims from entering the United States should be taken into account. That would be bad news for the administration.

“This is not a Muslim ban,” Acting Solicitor General Jeffrey Wall, arguing for the government, told the judges during the hearing that lasted two hours, twice as long as scheduled.

Judge Robert King, named by Democratic former President Bill Clinton, told Mr Wall that Mr Trump has never retracted previous comments about wanting to impose a ban on Muslims.

“He's never repudiated what he said about the Muslim ban,” Judge King asked, referring to Mr Trump's campaign promise for a “total and complete shutdown of Muslims entering the United States”.

The controversial orders Donald Trump has already issued Show all 9 1 /9 The controversial orders Donald Trump has already issued The controversial orders Donald Trump has already issued Trump and the media White House Press Secretary Sean Spicer takes questions during the daily press briefing Getty Images The controversial orders Donald Trump has already issued Trump and the Trans-Pacific Partnership Union leaders applaud US President Donald Trump for signing an executive order withdrawing the US from the Trans-Pacific Partnership negotiations during a meeting in the Roosevelt Room of the White House in Washington DC. Mr Trump issued a presidential memorandum in January announcing that the US would withdraw from the trade deal Getty The controversial orders Donald Trump has already issued Trump and the Mexico wall A US Border Patrol vehicle sits waiting for illegal immigrants at a fence opening near the US-Mexico border near McAllen, Texas. The number of incoming immigrants has surged ahead of the upcoming Presidential inauguration of Donald Trump, who has pledged to build a wall along the US-Mexico border. A signature campaign promise, Mr Trump outlined his intention to build a border wall on the US-Mexico border days after taking office Getty Images The controversial orders Donald Trump has already issued Trump and abortion US President Donald Trump signs an executive order as Chief of Staff Reince Priebus looks on in the Oval Office of the White House. Mr Trump reinstated a ban on American financial aide being granted to non-governmental organizations that provide abortion counseling, provide abortion referrals, or advocate for abortion access outside of the United States Getty Images The controversial orders Donald Trump has already issued Trump and the Dakota Access pipeline Opponents of the Keystone XL and Dakota Access pipelines hold a rally as they protest US President Donald Trump's executive orders advancing their construction, at Columbus Circle in New York. US President Donald Trump signed executive orders reviving the construction of two controversial oil pipelines, but said the projects would be subject to renegotiation Getty Images The controversial orders Donald Trump has already issued Trump and 'Obamacare' Nancy Pelosi who is the minority leader of the House of Representatives speaks beside House Democrats at an event to protect the Affordable Care Act in Los Angeles, California. US President Donald Trump's effort to make good on his campaign promise to repeal and replace the healthcare law failed when Republicans failed to get enough votes. Mr Trump has promised to revisit the matter Getty Images The controversial orders Donald Trump has already issued Donald Trump and 'sanctuary cities' US President Donald Trump signed an executive order in January threatening to pull funding for so-called "sanctuary cities" if they do not comply with federal immigration law AP The controversial orders Donald Trump has already issued Trump and the travel ban US President Donald Trump has attempted twice to restrict travel into the United States from several predominantly Muslim countries. The first attempt, in February, was met with swift opposition from protesters who flocked to airports around the country. That travel ban was later blocked by the Ninth Circuit Court of Appeals. The second ban was blocked by a federal judge a day before it was scheduled to be implemented in mid-March SANDY HUFFAKER/AFP/Getty Images The controversial orders Donald Trump has already issued Trump and climate change US President Donald Trump sought to dismantle several of his predecessor's actions on climate change in March. His order instructed the Environmental Protection Agency to reevaluate the Clean Power Plan, which would cap power plant emissions Shannon Stapleton/Reuters

Mr Wall told the judges past legal precedent holds that the court should not look behind the text of Mr Trump's executive order, which does not mention any specific religion, to get at its motivations.

Judge Paul Niemeyer, appointed by Republican former President George H.W. Bush, told Omar Jadwat, the American Civil Liberties Union lawyer representing the plaintiffs who challenged the order, that they were asking the judiciary to second guess a president's national security judgments.

“You have the judiciary supervising and assessing how the executive is carrying out his office,” Judge Niemeyer said. “I just don't know where this stops.”

The revised travel ban was challenged in Maryland by refugee organisations and individuals who said they would be harmed. They said it violated federal immigration law and a section of the US Constitution's First Amendment barring the government from favouring or disfavouring a particular religion.

The administration appealed a 15 March ruling by Maryland-based federal judge Theodore Chuang that put the ban on hold just a day before it was due to go into effect.

The arguments marked the latest legal test for Mr Trump's ban, which also was blocked by federal judge Derrick Watson in Hawaii in a separate legal challenge. An earlier version of the ban was also blocked by the courts.

Judge Pamela Harris said Mr Trump's action clearly had a disparate impact on Muslims, asking, “How is this neutral in its operation as to Muslims?” Judge Barbara Keenan, who like Judge Harris was appointed by Democratic former President Barack Obama, said the order could affect some 200 million people.

Judge Chuang, in Maryland, blocked the part of Mr Trump's order relating to travel by people from the six countries. Judge Watson, in Hawaii, also blocked another part of the order that suspended the entry of refugees into the United States for four months.

Regardless of how the 13 judges rule in Virginia, the matter is likely to be decided ultimately by the US Supreme Court. The full 4th Circuit took up the appeal but two Republican-appointed judges did not participate. That left nine judges appointed by Democratic presidents, three Republican appointees and one judge originally appointed by a Democrat and later re-appointed by a Republican.

It is unclear when the Virginia court will rule.

Mr Wall said the temporary ban was intended to give the government time to evaluate whether people from the six countries were being subjected to adequate vetting to ensure they did not pose a security threat to the United States.

Mr Wall was asked what the administration had done since Mr Trump signed the two orders to improve vetting procedures, given that the 90 days the government said it needed for a review after the order was first signed in January had passed.

Mr Wall told the court “we have put our pens down”, because of the rulings from the courts that blocked the orders. He said that while some work had been done more generally, “since 16 March, we have done nothing to review the vetting procedures for these countries”.

Mr Trump issued the March executive order after federal courts blocked an earlier version, issued a week after he took office, that also had included Iraq among the nations targeted. That order, which went into effect immediately, triggered chaos and protests at airports and in several cities before being put on hold due to legal challenges.

The second order was intended to overcome the legal problems posed by the original ban.

The administration's appeal in the Hawaii case will be heard in Seattle on 15 May by a three-judge panel of the San Francisco-based 9th US Circuit Court of Appeals. The three judges assigned all are Democratic appointees.