A federal judge blocked the government from deporting immigrants being held due to President Donald Trump's executive immigration order.

Federal Judge Ann M. Donnelly of the Eastern District of New York Courthouse in Brooklyn granted an injunction in response to a request filed by the American Civil Liberties Union and other legal organizations on behalf of individuals subject to President Trump's immigration ban from seven predominantly Muslim countries.

The stay blocks anyone with a valid visa being held at airports from being deported.

The stay applies only to those currently within the U.S., but not to anyone who tries to come to the U.S. going forward. And it does not mean detainees will be released, only that they can't be deported, according to ACLU attorneys.

Federal Judge Ann M. Donnelly of the Eastern District of New York Courthouse in Brooklyn granted an injunction in response to a request filed by the American Civil Liberties Union and other legal organizations on behalf of individuals subject to President Trump’s immigration ban from seven predominantly Muslim countries.

"Everyone now who came is safe, and that is absolutely critical. The courts worked the way they're supposed to work in our country," Lee Gelernt, Deputy Legal Director for the ACLU's Immigrants Rights Project, told MSNBC. "The president could not override the courts."

The ACLU said the judge ordered a list of detainees to be provided, and said it would go through the names and ensure they are released.

The Department of Homeland Security issued a statement early Sunday that said the court order would not affect the overall implementation of the White House order and that the court order affected a small number of travelers who were inconvenienced by security procedures upon their return.

"President Trump's Executive Orders remain in place. Prohibited travel will remain prohibited, and the U.S. government retains its right to revoke visas at any time if required for national security or public safety," the statement said.

Stephen Miller, a senior adviser to the White House, said: "Nothing in the Brooklyn judge's order in anyway impedes or prevents the implementation of the president's executive order which remains in full, complete and total effect."

The judge's order was hailed as a victory for activists fighting the president's order, but some qualified it as a small one in a larger battle.

"We believe the executive order is unconstitutional," ACLU Executive Director Anthony Romero told MSNBC. "We believe it violates the Fifth Amendment. We believe it violates the First Amendment. We think it's illegal under existing immigration statues. So we will live to fight another day to make sure this executive order dies on the vine."

[NATL] Trump Immigration Order Triggers Protests Across US

U.S. Sen. Tammy Duckworth, D-Ill., told MSNBC that the executive action resulted in infringements on the constitutional rights of detained travelers.

"Some of the folks who have been detained are American citizens," she said. "This is not all refugees."

She called what happened to travelers Saturday "a dangerous thing."

It was unclear how quickly the order might affect people in detention, the Associated Press was reporting.

[NATL] Top News Photos: Pope Visits Japan, and More

The order signed by Trump on Friday puts in place a 120-day hold on entry of refugees to the U.S., and indefinitely suspends the admission of Syrian refugees until the president is satisfied that changes have been made.

It also suspends entry for 90 days from certain nations based on statute related to the Visa Waiver Program. The most recent version of that program lists Iraq, Syria, Iran, Sudan, Libya, Somalia, and Yemen.

Critics blasted the order as "Muslim ban," which Trump has denied. Trump said the order was necessary to keep foreign terrorists out of the U.S. The president on the campaign trail and after taking office called for "extreme vetting" of some entering the country.

Under Trump's order, it had appeared that an untold number of foreign-born U.S. residents now traveling outside the U.S. could be stuck overseas for at least 90 days even though they held permanent residency "green cards" or other visas. However, an official with the Department of Homeland Security said Saturday night that no green-card holders from the seven countries cited in Trump's order had been prevented from entering the U.S.

Omar Jadwat, director of the ACLU Immigrants Rights Project, told MSNBC that the goal going forward now is to ensure there are no more widespread airport detentions as there were Saturday.

"We will continue to put pressure on the government to try to ensure that people are not detained, because again, these are people who have gone through the whole process," he said, referring to the vetting procedures already in place for refugees and others entering the country.

"Stay is granted," ACLU Voting Rights Project Director Dale Ho announced earlier on Twitter. "Stay is national."

The ACLU's Gelernt said in a statement:

“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.”

The ACLU filed the suit on behalf of two Iraqi refugees who were detained after arriving at New York's John F. Kennedy Airport following the order. They were later released, and a senior Trump administration official said waivers would be granted.

Protests erupted in multiple airports across the nation Saturday over the order.

On Sunday morning, Trump reiterated his support for "extreme vetting" in a tweet.

"Our country needs strong borders and extreme vetting, NOW. Look what is happening all over Europe and, indeed, the world - a horrible mess!" he wrote.