A US judge has issued a temporary halt to the deportation of visa holders or refugees stranded at airports following President Trump’s executive order.
The American Civil Liberties Union (ACLU) filed a case in response to the order issued on Friday.
The group estimates that between 100 and 200 people are being detained at airports or in transit.
Thousands of people have been protesting at US airports over Mr Trump’s clampdown on immigration.
His executive order halted the entire US refugee programme and also instituted a 90-day travel ban for nationals from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen.
Those who were already mid-flight were detained on arrival – even if they held valid visas or other immigration permits.
On Saturday, Mr Trump told reporters: “It’s working out very nicely. You see it at the airports, you see it all over.”
The ruling, from US District Judge Ann Donnelly in New York, prevented the removal from the US of people with approved refugee applications, valid visas, and “other individuals… legally authorised to enter the United States”.
The emergency ruling also said there was a risk of “substantial and irreparable injury” to those affected.
Her ruling is not on the constitutionality of Mr Trump’s executive order. What will happen to those still held at airports remains unclear.
Early on Sunday, the Department of Homeland Security said it would comply with judicial rulings but would continue to enforce Mr Trump’s order.
The case was brought early on Saturday on behalf of two Iraqi men detained at JFK Airport in New York.
One worked for the US military in Iraq. The other is married to a former US military contract employee.
Both have now been released. Another court hearing is set for 10 February.
Lee Gelernt, deputy legal director of the Immigrants Rights Project, argued the case in court and was greeted by a cheering crowd outside.
He said that some people had been threatened with being “put back on a plane” later on Saturday.
“The judge, in a nutshell, saw through what the government was doing and gave us what we wanted, which was to block the Trump order and not allow the government to remove anybody who has come and is caught up in the order, nationwide,” he told the crowd.
While Judge Ann Donnelly ordered that the refugees and others trapped at airports could not be sent back to their home countries, the ruling stopped short of allowing them into America.
Nor did she address the constitutionality of the highly controversial executive order. Those held at airports might now be kept in detention while the case is resolved. A hearing is scheduled for the end of next month.
The American Civil Liberties Union said the ruling proved that the courts were the bulwark of US democracy and that when Donald Trump enacted laws or executive orders that were unconstitutional or illegal, the courts would protect people’s rights.
After just one week, it said, Donald Trump had suffered his first loss in court.
Mr Gelernt also said the judge had ordered the government to provide a list of names of those detained under the order.
“We are going to see each of the people, provide counsel, try and get them out of detention right now – but at minimum, they will not be returned back to danger,” Mr Gelernt said.
In addition to those detained on arrival in the US, some air passengers were prevented from boarding US-bound flights after the order was signed.
On Saturday five Iraqi passengers and a Yemeni national were prevented from boarding a flight at Cairo airport bound for New York.
Dutch airline KLM said it had turned away seven people who were booked on to its flights into the US because they would no longer have been accepted
The restriction applies to dual nationals – so, for example, a British citizen who is also a citizen of Iran would not be able to enter the US.
Sign up for GhanaStar.com to receive daily email alerts of breaking news in Ghana. GhanaStar.com is your source for all Ghana News. Get the latest Ghana news, breaking news, sports, politics, entertainment and more about Ghana, Africa and beyond.