A federal judge has blocked part of President Donald Trump's executive order on immigration, ruling that travellers who have already landed in the US with valid visas should not be sent back to their home countries.

Lawyers had filed a legal case in response to the order that includes a 90-day entry ban on citizens of seven Muslim-majority nations.

US District Judge Ann Donnelly's ruling late on Saturday concerns dozens of people who were detained at US airports following Trump's actions.

The American Civil Liberties Union (ACLU), which had filed a class action lawsuit against the ban, hailed the temporary stay of execution as a victory.

"This ruling preserves the status quo and ensures that people who have been granted permission to be in this country are not illegally removed off US soil," Lee Gelernt, deputy director of the ACLU's Immigrants' Rights Project, said.

ACLU said it would help 100 to 200 people with valid visas or refugee status, who found themselves detained in transit or at US airports after Trump signed the order late on Friday.

The legal case was raised after two Iraqis were held by law enforcement officials at John F Kennedy International Airport (JFK) while trying to legally enter the country.

More than 100 detained

At least 12 travellers have been detained at JFK, prompting mass protests at the airport.

Less than 24 hours into the ban, Homeland Security said that at least 109 travellers had been denied entry into the US in total.

Homeland Security said on Sunday it would "comply with judicial orders", referring to Donnelly's ruling, but that Trump's order remains in place.

A group of state attorneys general, meanwhile, are discussing whether to file their own court challenge against the order, officials in three states told the Reuters news agency.

Officials in the offices of attorneys general in Pennsylvania, Washington and Hawaii said they were evaluating what specific claims could be filed, and in which court.

READ MORE: World leaders condemn Trump's 'Muslim ban'

Trump signed the executive order on Friday that effectively denies entry to people from seven Muslim-majority countries, including those with green cards, who otherwise have permanent residence in the US.

Signing the order at the Pentagon, Trump said the move would help protect Americans from "terrorist" attacks.

'Absolute chaos'

"It's been absolute chaos at airports across the country," Abed Ayoub, legal and policy director of the Arab-American Anti-Discrimination Committee, told Al Jazeera. "It's definitely not making America safe again, it's just making America hate again."

He added that the order "doesn't only concern American Muslims, it concerns Americans. [Trump's] hate rhetoric is turning into destructive policies."

In the case of war-torn Syria, Trump qualified the order's scope by saying he would prioritise Syrian Christians entering as refugees.

Al Jazeera's John Hendren, reporting from Chicago's O'Hare International Airport, said: "People who were already here are not allowed to be deported under that court order ... [But] this was only a temporary reprieve. Not everybody who has been trying to get into this country has been able to get here. We really don't know the end of this story."

The order limits entry for at least 90 days from Syrian travellers and other Muslim-majority countries, but did not list the countries by name. The state department said the three-month ban in the directive applied to Iraq, Syria, Iran, Sudan, Libya, Somalia and Yemen - all Muslim-majority nations.

Al Jazeera's Osama Bin Javaid, reporting from Erbil in northern Iraq, said: "There is a lot of angst among the Kurdish population of Iraq, because if there's a spat between Baghdad and Washington, these are the people who will be worst affected."

He added: "So far from the people we have spoken to there is anger and shock. These are people who have been working side-by-side with American forces and contractors in various roles. They are not sure how it's going to pan out. Families have been separated."

Canadian Prime Minister Justin Trudeau weighed in on Saturday on Trump's orders with a decidedly different approach.

"To those fleeing persecution, terror & war, Canadians will welcome you, regardless of your faith. Diversity is our strength #WelcomeToCanada," he tweeted, along with a photograph of him greeting a Syrian child at a Toronto airport.

A spokeswoman for Trudeau told The Associated Press, he is "looking forward to discussing the successes of Canada's immigration and refugee policy" when he meets with Trump at the White House - a meeting that is expected in the near term.

"I think we keep fighting," Sarah Owing, with the American Immigration Lawyers Association's, told Al Jazeera. "We're not going to rest until we make sure that the constitutional rights of lawful permanent residents are respected, and that those that seek asylum on our shores are entitled and given all the rights to seek that form of relief."