Media playback is unsupported on your device Media caption President Trump's travel ban court battle explained

The US justice department has defended President Donald Trump's travel ban and urged an appeals court to reinstate it in the interests of national security.

A 15-page brief argued it was a "lawful exercise of the president's authority" and not a ban on Muslims.

The executive order temporarily banned entry for all refugees and visitors from seven mainly Muslim countries.

A hearing has been set for Tuesday on whether to allow or reject the ban.

The filing was made to the San Francisco-based 9th US Circuit Court of Appeals in response to the halting of Mr Trump's order on Friday by a federal judge in Washington state.

The judge had ruled the ban was unconstitutional and harmful to the state's interests.

As a result, people from the seven countries - Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen - with valid visas were able to travel to the US again.

What did the department of justice argue?

The brief filed on Monday evening said the Washington court had "erred in entering an injunction barring enforcement of the order".

"But even if some relief were appropriate, the court's sweeping nationwide injunction is vastly overbroad," the department of justice added.

The key arguments in the brief are:

the president is best placed to make decisions about national security

it is "incorrect" to call it a ban on Muslims because the seven countries were identified for their terror risk

the executive order is therefore "neutral with respect to religion"

aliens outside the US have no rights to due process

Image copyright European photopress agency Image caption Yemeni nationals denied entry have started arriving again

Confusion at airports

The executive order issued by President Trump on 25 January fulfilled his campaign promise to tighten restrictions on arrivals to the US.

Its main components were:

nationals from Iraq, Syria, Iran, Libya, Somalia, Sudan and Yemen - even those with visas - banned from entering the US;

a temporary ban on all refugee admissions;

the reprioritisation of minority religion (interpreted to mean Christian) refugee claims;

a ban on all Syrian refugees;

a cap on total annual refugee admissions to the US of 50,000.

It caused confusion at US and foreign airports when it came into force, and was widely condemned, although polls suggest that US public opinion is sharply divided on the policy.

Who has spoken out against the ban?

The states of Washington and Minnesota have argued that as well as being unconstitutional, the travel ban is harmful to their residents, businesses and universities.

Attorneys general in 16 states have signed a letter condemning the ban, and lawsuits have been launched in 14 states.

Former secretaries of state John Kerry and Madeleine Albright and former CIA director Leon Panetta have joined others in drafting a letter which describes the travel ban as ineffective, dangerous and counterproductive.

And lawyers for tech firms including Apple and Google have also lodged arguments with the court, saying that the travel ban would harm their companies by making it more difficult to recruit employees.

Supreme Court battle looms

Image copyright Twitter

Mr Trump's tweets are in line with the arguments from the Department of Justice - that national security is at risk.

The president has attacked the "so-called" judge behind the Washington ruling, and said: "If something happens blame him and court system."

Media playback is unsupported on your device Media caption 'All over Europe it's happening. It's gotten to a point where [attacks are] not even being reported'

Whatever the decision of the appeals court on Tuesday, the case could end up in the highest court in the US, the Supreme Court.

The last immigration case that reached the justices there ended in a 4-4 tie.

But if Mr Trump's nominee to fill the ninth berth, Neil Gorsuch, is confirmed in time, it could tip the balance in the president's favour.