A federal judge in New York has issued an emergency stay temporarily halting the removal of individuals detained after President Trump issued an order to ban immigrants from seven Muslim-majority countries from entering the U.S.

The move appears to mark the first successful legal challenge to the Trump administration and affects those who have arrived in the U.S. with previously approved refugee applications or were in transit with valid visas. Similar rulings were later issued in Virginia, Massachusetts and Washington state.

U.S. District Court Judge Ann Donnelly ruled in favor of a habeas corpus petition filed by the American Civil Liberties Union (ACLU) on behalf of two Iraqi men who were detained at John F. Kennedy International Airport on Friday after Trump signed his order.

Donnelly, who was nominated by former President Barack ObamaBarack ObamaTrump to visit African American History Museum White House adds to report on Trump's Sunday golf game British Parliament members hold heated debate over Trump visit MORE and confirmed to her judgeship in 2015, ruled in the Eastern District of New York that "there is imminent danger that, absent the stay of removal, there will be substantial and irreparable injury to refugees, visa-holders, and other individuals from nations subject" to Trump's order.

ADVERTISEMENT
“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 U.S. soil," said Lee Gelernt, deputy director of the ACLU’s Immigrants’ Rights Project.

The ruling deals with a portion of Trump's order handed down Friday, which bars Syrian refugees indefinitely and halts the resettlement of all refugees for four months as the administration reviews the vetting process.

The order also denies entry for 90 days for all individuals from Syria and six other predominantly Muslim countries: Iraq, Iran, Somalia, Sudan, Libya and Yemen.

“Clearly the judge understood the possibility for irreparable harm to hundreds of immigrants and lawful visitors to this country," ACLU Executive Director Anthony D. Romero said in a statement.

"Our courts today worked as they should as bulwarks against government abuse or unconstitutional policies and orders. On week one, Donald TrumpDonald TrumpTrump and Democrats must work together or face the wrath of voters Ex-CIA analyst resigns rather than serve Trump administration Matt Schlapp op-ed: Challenges, controversy won't stop CPAC 2017 MORE suffered his first loss in court.”

The order Saturday evening capped off a chaotic first day following Trump's directive, as the administration moved to implement his order, with reports emerging of individuals being detained at a number of airports across the country.

The Department of Homeland Security said Trump's order would also apply to green card holders from the seven impacted countries.

"President Trump and his administration are right to be concerned about national security, but it’s unacceptable when even legal permanent residents are being detained or turned away at airports and ports of entry," Republican Sen. Jeff FlakeJeff FlakeGOP sets sights on internet privacy rules Overnight Tech: GOP chairman to propose high-skilled visa overhaul | Zuckerberg's 5,700 word letter | Tech lobbies gear up ahead of internet fight Senate Dem blasts GOP for trying to repeal broadband privacy rules MORE (Ariz.) said in a statement.

A senior administration official said green card holders from the affected countries who are currently outside the U.S. will need a case-by-case waiver to return to the U.S. and green card holders in the U.S. would need to meet with a consular officer before leaving the country.

An administration official also said that Trump advisers had been in contact with the State Department and Department of Homeland Security for weeks prior to the issuing of his Friday order, arguing it affected a "relatively small" number of people.

"It’s important to keep in mind that no person living or residing overseas has a right to entry to the U.S.," the official said.

But backlash on Saturday to the order was swift from civil-rights groups,various Democratic officials and businesses, which condemned it as a departure from the U.S. tradition of accepting refugees and comparing it to Trump's campaign proposal to temporarily ban Muslim migrants.

Rep. Nydia Velázquez (D-N.Y.) slammed Trump’s executive order outside JFK, where she and fellow Rep. Jerrold Nadler (D-N.Y.) worked to secure the release of the two Iraqi men, calling it “arbitrary” and “unjust.”

Democrats also pressed the Trump administration for further explanation on the order, with Senate Minority Leader Charles SchumerCharles SchumerCEOs praise House GOP border tax proposal Overnight Cybersecurity: Trump defends Flynn, blasts leaks | Yahoo fears further breach Overnight Finance: Trump's Labor pick withdraws | Ryan tries to save tax plan | Trump pushes tax reform with retailers MORE (D-N.Y.) calling on the Department of Homeland Security to immediately "rescind" it. 

"It's not a Muslim ban, but we are totally prepared," Trump told media gathered in the Oval Office on Saturday afternoon as he signed three new executive orders on lobbying, a plan to defeat the Islamic State in Iraq and Syria (ISIS) and a reorganization of the National Security Council.
 
"It's working out very nicely. You see it in the airports, you see it all over. It's working out very nicely and we are going to have a very, very strict ban and we are going to have extreme vetting, which we should have had in this country for many years," Trump said.
 
Updated: Jan. 29 at 6:30 a.m.