The fierce battle over Donald Trump's travel and refugee ban is heading for a possible final showdown at the US Supreme Court.
The Justice Department filed a new defence of the president's ban on travellers from seven predominantly Muslim nations as a federal appeal court considers whether to restore the administration's executive order.
The lawyers said the ban was a "lawful exercise" of the president's authority to protect national security and a judge's order that put the policy on hold should be overruled.
The filing with the San Francisco-based 9th US Circuit Court of Appeals was the latest salvo in a high-stakes legal fight surrounding Mr Trump's order, which was halted by a federal judge in Washington state on Friday.
A randomly-selected panel of appeal judges will hear arguments on Tuesday.
The appeal court earlier refused to immediately reinstate the ban, and lawyers for two states challenging it - Washington and Minnesota - argued anew on Monday that any resumption would "unleash chaos again", separating families and stranding university students.
The Justice Department responded that the president had clear authority to "suspend the entry of any class of aliens" to the US in the name of national security.
It said the travel ban, which temporarily suspends the country's refugee programme and immigration from seven countries with terrorism concerns, was intended "to permit an orderly review and revision of screening procedures to ensure that adequate standards are in place to protect against terrorist attacks".
The challengers of the ban, the Justice Department wrote, were asking "courts to take the extraordinary step of second-guessing a formal national security judgment made by the president himself pursuant to broad grants of statutory authority".
Whatever the appeal court decides, either side could ask the Supreme Court to intervene.
The threat from radical Islamic terrorism is very real, just look at what is happening in Europe and the Middle-East. Courts must act fast!— Donald J. Trump (@realDonaldTrump) February 7, 2017
It could prove difficult though, to find the necessary five votes at the high court 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.
The president's executive order has faced legal uncertainty ever since Friday's ruling by US district judge James Robart, which challenged both Mr Trump's authority and his ability to fulfil a campaign promise.
The State Department quickly said people from the seven countries - Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen - with valid visas could travel to the US and the Homeland Security Department said it was no longer directing airlines to prevent affected visa holders from boarding US-bound planes.
The legal battle involves two divergent views of the role of the executive branch and the court system.
The government has asserted that the president alone has the power to decide who can enter or stay in the United States, while Judge Robart has said a judge's job is to ensure an action taken by the government "comports with our country's laws".
His ruling on Friday triggered a Twitter rant by Mr Trump, who dismissed Judge Robart as a "so-called judge".
On Sunday, Mr Trump tweeted: "Just cannot believe a judge would put our country in such peril. If something happens blame him and court system. People pouring in. Bad!"
He was back on Twitter on Monday night, stating: "The threat from radical Islamic terrorism is very real, just look at what is happening in Europe and the Middle-East. Courts must act fast!"
States challenging the ban have been joined by technology companies which have said it makes it more difficult to recruit staff and national security chiefs under Barack Obama have also come out against it.
A declaration filed by former secretaries of state John Kerry and Madeleine Albright, along with others, said the ban would disrupt lives and cripple US counter-terrorism partnerships without making the nation safer.
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.
The bench also could be full, with a new ninth justice on board, by the time the court is ready to hear arguments.
If Judge Neil Gorsuch is confirmed this spring as Senate Republicans hope, chances of a tie vote would disappear.
Meanwhile Mr Trump vowed to allow only people who "want to love our country" into the US as he made his first visit to MacDill air force base in Florida, the headquarters of US Central Command.
He reaffirmed his support for Nato before military leaders and troops and laced his speech with references to homeland security, but did not mention the court case directly.
"We need strong programmes" so that "people that love us and want to love our country and will end up loving our country are allowed in" and those who "want to destroy us and destroy our country" are kept out, Mr Trump said.
"Freedom, security and justice will prevail. We will defeat radical Islamic terrorism and we will not allow it to take root in our country. We're not going to allow it."
He also complained about media coverage of terrorist attacks, suggesting many were intentionally unreported by the media.
In response to requests for evidence to support that claim, the White House released a list of 78 attacks it described as "executed or inspired by" the Islamic State terror group since September 2014.
Most on the list did not receive sufficient media attention, the White House said.
The list included incidents such as the lorry massacre in Nice, France, that killed dozens and received widespread attention, as well as less high-profile incidents in which nobody was killed.