President Donald Trump signs an executive order to impose tighter vetting of travelers entering the United States, at the Pentagon in Washington, 27 January 2017 Reuters/Carlos Barria

On Friday 27 January President Donald Trump banned people from seven Muslim countries from entering the US and blocked refugee claims from those countries for months.

Confusion soon began to reign at airports throughout the US as some people holding valid American government-issued visas and green cards were turned away at the border and a number of federal courts issued temporary injunctions against the Presidential order. US Customs and Border Protection said it was working to "comply with the orders" and simultaneously "implement President Trump's executive order" – a difficult feat as elements of the two were at odds with each other.

But what does Trump's executive order actually say?

Firstly, the Protecting the Nation From Foreign Terrorist Entry Into The United States order bans people from the predominantly Muslim nations of Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen from entering the US for 90 days. It also stops refugee applications from these nations for four months, and bans Syrian refugees from the US indefinitely. The order is open for extension and expansion to include other countries too.

The ban, which took effect immediately, also included anyone with a travel visa to the US that wasn't issued in connection with an embassy or NGO and was in transit when the order was signed. And it left out mention of green card holders who are in the process of becoming a permanent resident. Federal court injunctions have allowed visa holders in, and the Trump administration waived the rules for green card holders from the seven nations who were stopped at the border.

Trump's order says the Secretary of Homeland Security, Secretary of State, and Director of National Intelligence will "immediately conduct a review to determine the information needed from any country" to issue a visa or other form of entry – such as a work permit – to the US. If they don't get the information they want from each of the countries listed in the ban, the ban will continue.

Justification for the ban rests on Trump's assertion that since the terrorist attacks of September 11 "numerous foreign-born individuals have been convicted or implicated in terrorism-related crimes" after entering the US on visitor, student, or employment visas, or through the refugee resettlement program.

However "foreigners from those seven nations have killed zero Americans in terrorist attacks on US soil between 1975 and the end of 2015," said Alex Nowrasteh, an immigration expert at the libertarian Cato Institute, in a blog post. "Six Iranians, six Sudanese, two Somalis, two Iraqis, and one Yemini have been convicted of attempting or carrying out terrorist attacks on US soil." Exactly no Libyans or Syrians, Nowrasteh added, "have been convicted of planning a terrorist attack on US soil during that time."

Trump also targets the US Refugee Admissions Program (USRAP), saying he will suspend it for 120-days, approximately four months, and indefinitely bar Syrian refugees because they are "detrimental to the interests of the United States."

His order also said that "the entry of more than 50,000 refugees in fiscal year 2017 would be detrimental" to the US and that Trump will "suspend any such entry until such time as I determine that additional admissions would be in the national interest."

All refugees currently undergo a 20 step series of interviews and vetting procedures through the United Nations, US State Department, United States Citizenship and Immigration Services, and the Department of Homeland Security.

Trump insists that increased vetting will ensure that "those who do not support the Constitution, or those who would place violent ideologies over American law" don't enter the US.

A court battle is already brewing. On Monday 30 January The Council on American–Islamic Relations launched a law suit against the Trump administration over the executive order.

Acting US attorney general Sally Yates was also sacked Monday night after she directed Department of Justice attorneys not to defend Trump's executive order in court because she didn't think it was lawful.

The White House said in a statement that Yates "has betrayed the Department of Justice by refusing to enforce a legal order designed to protect the citizens of the United States."

But the Trump administration is also considering softening the order with "implementation guidance" to the Department of Homeland Security, Republican sources told Mike Allen of Axios, and even allow policy changes in the order.

Read the full text of the Protecting the Nation From Foreign Terrorist Entry Into The US.