Image copyright AFP Image caption Protests were organized in many US cities

On 27 January President Donald Trump signed an executive order halting all refugee admissions and temporarily barring people from seven Muslim-majority countries.

The move sparked numerous protests and legal challenges. A week later a federal judge in Seattle suspended it nationwide, allowing banned visitors to travel to the US pending an appeal by the administration.

Mr Trump and his supporters say the controversial executive order makes good on election promises to "make America great again".

But what is the order, dubbed the "Muslim ban" by those rallying against it, and who exactly does it affect?

Here are some key points from the full text explained.

What is the order?

It brings in a suspension of the US Refugee Admissions Programme for 120 days

There is also an indefinite ban on Syrian refugees

And anyone arriving from seven Muslim-majority countries - Iraq, Syria, Iran, Libya, Somalia, Sudan, and Yemen - faces a 90-day visa suspension. Some visa categories, such as diplomats and the UN, are not included in the suspension

The order also introduces a cap of 50,000 refugees to be accepted in 2017, against a limit of 110,000 set by former President Barack Obama

Priority will be given to religious minorities facing persecution in their countries. In an interview, Mr Trump singled out Christians in Syria

Exceptions could be made on a case-by-case basis

Victims vent fury

World reaction

Order sows seeds of panic

Who is affected by the ban?

All travellers who have nationality of Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen are not permitted to enter the US for 90 days, or be issued an immigrant or non-immigrant visa.

People who have dual nationality with a non-restricted country are not affected, so long as they travel on the passport from the other country.

What about people with Green Cards?

Under the executive order, Green Card holders - permanent legal US residents - from the seven countries were initially subject to the same restrictions, causing widespread concern and confusion.

Two days after it was signed, the department for homeland security issued a statement saying that permanent legal residents would be determined on a case-by-case basis. But, it said, in the absence of significant information that they posed a threat, their permanent legal status would gain them entry to the US.

However, on 1 February, Donald McGahn, the legal counsel to the president, then issued a memo saying the travel ban did not apply to lawful permanent residents of the United States.

What did Trump say?

Mr Trump said the halt on the refugee programme was needed to give government agencies time to develop a stricter vetting system and ensure that visas were not issued to individuals posing a national security threat.

"To be clear, this is not a Muslim ban, as the media is falsely reporting," the president said in a statement released on Facebook.

"This is not about religion - this is about terror and keeping our country safe. There are over 40 different countries worldwide that are majority Muslim that are not affected by this order."

Image copyright Getty Images Image caption Mr Trump's order has been strongly criticised by rights groups

Syrians applying for resettlement in the US were already subject to a complex process of background investigation and security screenings, in a process that could take between 18 to 24 months.

Mr Priebus said the seven countries had been included because Congress and the Obama administration had identified them as "the most watched countries harbouring terrorists".

But was it legal?

This is being hotly contested through the US court system, with dozens of lawsuits filed, and the issue thought likely to end up in the Supreme Court.

Key dates:

3 February: A Seattle federal judge suspends the order nationwide, in response to a challenge by the Washington State attorney general, who argued that the executive order violated a clause in the US constitution that prohibits the favouring of one religion over another.

5 February: A request by Mr Trump's administration for an immediate reinstatement of the order is rejected by the 9th Circuit Court of Appeals in San Francisco.

9 February: A three-judge panel in the same court rules unanimously against reinstating the ban, after hearing arguments from lawyers from the Department of Justice and Washington State.

In a series of tweets since the Seattle ruling, Mr Trump has criticised the suspension, saying the ruling came from a "so-called judge", and that the courts were "making the job very difficult!", and later describing the courts as "so political". After the San Francisco appeals court decision, he tweeted "SEE YOU IN COURT".

What are the legal arguments?

In the past, the US used to ban entrants from specific countries and entire regions.

But in 1965, the US Congress passed the Immigration and Nationality Act which said that no person could be "discriminated against in the issuance of an immigrant visa because of the person's race, sex, nationality, place of birth or place of residence".

So, the exclusion of all Syrians would be enough to challenge Mr Trump in court. The fact that they are all Muslim countries lends weight to the critics's argument that the order is "anti-Muslim".

Supporters of Mr Trump's order mentioned the post-9/11 attacks and the ability of the administration to take measures to protect national security.

And they cited the president's powers stemming from a 1952 law on "Inadmissible Aliens" to "suspend the entry" of "any class of aliens" that he finds are detrimental to the interest of the US.

They also suggested that US presidents can set aside the 1965 law. The most cited example is that of President Jimmy Carter who barred some Iranians during the 1980 hostage crisis.

How was the order implemented?

The order initially triggered a lot confusion and uncertainty. Before its temporary suspension on Friday, a federal judge issued a temporary halt to the deportation of visa holders or refugees stranded at US airports. More than 100 people were detained at airports or in transit

Air passengers were prevented from boarding US-bound flights

American citizens travelling to the seven countries could be detained for questioning as well in the future, Mr Trump's chief of staff, Reince Priebus, said

Image copyright Reuters Image caption Demonstrations against the order were held in Dallas and other US airports

What do critics say?

Rights groups say Mr Trump's order targeted Muslims because of their faith and that no refugees had been convicted of terrorism-related crimes.

They also said that the most recent attacks in the US were carried out by US nationals or citizens from the countries not included in the travel ban:

Image copyright Reuters Image caption Out of the 84,995 refugees that entered the US in 2016, 12,486 were from Syria, according to the Pew Research Center

While announcing the plan, Mr Trump cited the attacks of 11 September 2001. But none of the 19 hijackers who committed the attacks came from countries included in the suspension. They were from Saudi Arabia, the United Arab Emirates (UAE), Egypt and Lebanon.

Some pointed out that the list did not include countries where President Trump had business interests - like Saudi Arabia - a suggestion dismissed by the president's chief of staff as not related.