WASHINGTON - US President Donald Trump’s executive order targeting Muslims and refugees led to chaos in the hours after he signed it, as refugees and immigrants arrived at US airports only to be detained or told they couldn’t enter the country and businesses had to scramble to adjust to the new policy.

The move caused confusion and panic among travellers around the world, with many turned back from US-bound flights. “We are hearing that last night a lot of people were turned away,” said Abed Ayoub, legal director of the American-Arab Anti-Discrimination Committee. “It’s had a direct impact on a lot of people.”

The order, which Trump signed Friday afternoon, bans Syrian refugee resettlement in the US indefinitely, shuts down the entire refugee programme for 120 days and bars all immigrants and visitors from seven Muslim-majority countries from entering the US for at least 90 days.

The action prompted fury from Arab travellers in the Middle East and North Africa who said it was humiliating and discriminatory. It drew widespread criticism from US Western allies including France and Germany, Arab-American groups and human rights organisations.

Iran condemned the order as an “open affront against the Muslim world and the Iranian nation” and vowed to retaliate. Of the seven countries targeted, Iran sends the most visitors to the United States each year - around 35,000 in 2015, according to the Department of Homeland Security.

It was unclear how many green card holders would be affected, but exceptions can be made on a case-by-case basis.

Legal residents of the United States were plunged into despair at the prospect of being unable to return to the United States or being separated from family members trapped abroad. Immigration lawyers worked through the night to help stranded travellers and enforcement at entry points was uneven.

“I never thought something like this would happen in America,” said Mohammad Hossein Ziya, 33, who came to the United States in 2011 after being forced to leave Iran for his political activities.

Ziya, who lives in Virginia, has a green card and planned to travel to Dubai next week to see his elderly father. “I can’t go back to Iran, and it’s possible I won’t be able to return here, a place that is like my second country,” he said.

Saleh Taghvaeian, 36, teaches agricultural water management at Oklahoma State University in Stillwater, said he feared his wife will not be able to return from Iran after a visit. “In Iran they’re not being allowed to get on the airplane,” he said.

In Cairo, five Iraqi passengers and one Yemeni were barred from boarding an EgyptAir flight to New York on Saturday, sources at Cairo airport said. Dutch airline KLM said on Saturday it had refused carriage to the United States to seven passengers from predominately Muslim countries.

At least three lawyers from the International Refugee Assistance Project were at the arrivals lounge at New York City’s John F Kennedy International Airport’s Terminal 4, buried in their laptops and conference calls, photocopies of individuals’ US visas on hand.

“Just because Trump signed something at 6 pm yesterday, things are coming to a crashing halt,” said Mana Yegani, an immigration lawyer in Houston. “It’s scary.”

Enforcement of the order was spotty and disorganised. Travellers were handled differently at different points of entry and immigration lawyers were advising clients to change their destination to the more lenient airports, said Yegani, who works with the American Immigration Lawyers Association.

The order seeks to prioritize refugees fleeing religious persecution. In a television interview, Trump said the measure was aimed at helping Christians in Syria.

Trump senior adviser Kellyanne Conway reaffirmed the president’s decision in a Twitter post on Saturday. “@POTUS is a man of action and impact. Promises made, promises kept. Shock to the system. And he’s just getting started,” she tweeted.

Coming in the late hours of Friday, and with little apparent consultation with other agencies and groups prior to its publication, the order created havoc and confusion among those tasked with overseeing entry into the country.

In the hours after the president signed his executive order, government authorities detained two Iraqis at New York’s Kennedy Airport, The New York Times reported. One of the men, Hameed Khalid Darweesh, worked for the US government for 10 years as an interpreter. He was detained upon landing at Kennedy on Friday night, but his wife and children were let through, a former colleague of Darweesh’s said. Darweesh was released the following day.

The other detained man, Sameer Abdulkhaleq Alshawi, was coming to the country to join his child and wife, who had worked for a US government contractor, The Washington Post reported.

Lawyers for the two men told CNN they have filed a lawsuit against the president and the government over their detention. The action in federal court seeks a writ of habeas corpus — an order declaring their detention illegal — and the certification of a class action covering any immigrants and refugees denied admission at ports of entry across the country, according to the complaint filed in New York.

Google, meanwhile, told travelling staff members to come back to the US, BBC reported.

And refugee organisations began notifying volunteers that the families they planned to help were no longer on their way. Alisa Wartick, 36, said she and a group of 38 people in her neighbourhood had co-sponsored a Syrian refugee family through the organisation Refugee One in Chicago.

The family – a mother, father and 16-month-old daughter – was supposed to arrive on Monday to join the woman’s parents and siblings. The co-sponsorship group had already furnished their apartment, and met the family via FaceTIme so they could see their new home, which they now may never see again.

Church World Service, one of the organisations that handles refugee resettlement, had been planning to welcome 212 refugees next week, 164 of them joining family members already in the United States, according to a spokeswoman. Those 212 refugees are no longer expected to arrive.

Though Trump, on the campaign trail, had pledged to stop refugees from certain Muslim-majority countries from entering the United States, there was some skepticism that he would actually follow through on the proposal. Business groups had warned against it, as did religious organisations, including some with traditionally conservative political leanings.

The ripple effects of the executive order make clear the difficulty in taking a blunt campaign promise and applying it to real-world governance, with seemingly unforeseen outcomes and immediate, frightening disruption in people’s lives. People took to Twitter to share the uncertainty now surrounding their Syrian colleagues and friends.

Department of Homeland Security said Saturday that the president’s executive order will, in fact, stop green card holders from seven countries from returning to the United States if they travel abroad. “It will bar green card holders,” the spokeswoman said.

In a briefing with reporters, officials defended the scope and execution of the new executive order. Asked about lawsuits filed against the order, the officials declined specific comment, but said foreigners do not have a right to enter into the united States, and dismissed as “ludicrous” the notion that the move amounted to a “Muslim ban.”

An official said Afghanistan, Malaysia, Pakistan, Oman Tunisia and Turkey were Muslim-majority countries not included in the order.

A prominent Muslim advocacy group has announced that it will file a federal lawsuit against President Trump over his far-reaching executive order targeting Muslims.

The Council on American-Islamic Relations (CAIR) immediately announced it would be challenging the constitutionality of Trump’s directive in court “because its apparent purpose and underlying motive is to ban people of the Islamic faith from Muslim-majority countries from entering the United States.”

“The American Muslim community has been the target of discriminatory policies for many years now,” Lena Masri, CAIR’s national litigation director, said. “Generally speaking at this time the Muslim community is being attacked by this order. It’s important for Americans to stand together and rise together.”

CAIR said full details of the suit will be revealed on Monday.

US immigrant curbs cause chaos, anger worldwide