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 Donald Trump’s immigration order.
Donald Trump’s executive order halted the entire US refugee program 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 January 28, President Trump told reporters: “It’s working out very nicely. You see it at the airports, you see it all over.”
The ruling, from 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 authorized to enter the United States”.
The emergency ruling also said there was a risk of “substantial and irreparable injury” to those affected.
Judge Donnelly’s ruling is not on the constitutionality of Donald Trump’s executive order. What will happen to those still held at airports remains unclear.
The case was brought on January 28 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 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”.
“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,” Lee Gelernt told the crowd.
He 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,” Lee Gelernt said.
In addition to those detained on arrival in the US, some passengers were prevented from boarding US-bound flights after the order was signed.
On January 28, 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 US-bound flights because they would no longer have been accepted.
Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…