CNN - This comes after a federal judge in New York granted an emergency stay Saturday night for citizens of seven Muslim-majority countries who have already arrived in the US and those who are in transit, and who hold valid visas, ruling they cannot be removed from the US.
That move limited part of President Donald Trump's executive order barring citizens from those countries from entering the US for the next 90 days.
Similar legal rulings were made in Virginia and Washington state after the New York ruling was made.
"The Department of Homeland Security will comply with judicial orders; faithfully enforce our immigration laws, and implement the president's Executive Orders to ensure that those entering the United States do not pose a threat to our country or the American people," the department said.
On Saturday evening, the ACLU argued in a federal court in New York for a nationwide stay that would block the deportation of all people stranded in US airports under what the group called "President Trump's new Muslim ban."
US District Judge Ann Donnelly granted the stay.
"The petitioners have a strong likelihood of success in establishing that the removal of the petitioner and other similarly situated violates their due process and equal protection guaranteed by the United States Constitution," Donnelly wrote in her decision.
"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 the January 27, 2017, Executive Order."
The civil rights group is representing dozens of travelers held at John F. Kennedy International Airport Friday and Saturday, including two Iraqis with ties to the US military who had been granted visas to enter the United States.
The ruling does not necessarily mean the people being held at airports across the US are going to be released, said Zachary Manfredi, from Yale's Worker and Immigrant Rights Advocacy Clinic, who helped draft the emergency stay motion.
"The judge's order is that they (lawful visa/green card holders) not be removed from the US -- it doesn't immediately order that they be released from detention," he told CNN.
"We are hoping that CBP (Customs and Border Patrol), now that they no longer have a reason to detain them, will release them. But it is also possible they could be transferred to (other) detention facilities."
"We are getting the order to as many CBP officers as possible right now," he added.
The United States denied entry to 109 travelers heading to the country at the time the ruling was signed, a Department of Homeland Security official said. The agency would not say how many of them were sent already home and how many were detained.
ACLU Executive Director Anthony D. Romero praised the ruling, saying "our courts today worked as they should as bulwarks against government abuse or unconstitutional policies and orders. On week one, Donald Trump suffered his first loss in court."
Lee Gelernt, deputy director of the ACLU's Immigrants' Rights Project, who argued the case, said the 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."
Lawsuit is first challenge to executive order
The class-action lawsuit is the first legal challenge to Trump's controversial executive order, which indefinitely suspends admissions for Syrian refugees and limits the flow of other refugees into the United States by instituting what the President has called "extreme vetting" of immigrants.
The two Iraqis, Hameed Khalid Darweesh and Haider Sameer Abdulkaleq Alshawi, had been released by Saturday night. But lawyers for other detained travelers said in a court filing that "dozens and dozens" of individuals remained held at JFK.
Similar legal actions had been initiated in other states..
A federal court in Washington state issued a stay forbidding travelers being detained there from being sent back to their home country.
A federal court in Virginia has issued a temporary restraining order saying several dozen permanent residents returning from trips abroad should have access to lawyers while they are being detained at Dulles International Airport and these residents cannot be removed from the United States for seven days.
Trump's order, signed Friday, bars travel from seven Muslim-majority countries, including Iraq, to the US for 90 days. It also suspends the US Refugee Admissions Program for 120 days until it is reinstated "only for nationals of countries for whom" members of Trump's Cabinet deem can be properly vetted.
Released under special circumstances
According to court papers, both Darweesh and Alshawi were legally allowed to come into the US but were detained in accordance with Trump's order.
Darweesh, who worked as an interpreter for the US during the Iraq War, was released from detention early Saturday afternoon.
"America is the land of freedom," he told reporters at the airport shortly after his release. "America is the greatest nation."
A source with knowledge of the case confirmed Darweesh will be allowed into the US due to provisions in Trump's order that allow the State and Homeland Security departments to admit individuals into the US on a case-by-case base for certain reasons, including when the person is already in transit and it would cause undue hardship and would not pose a threat to the security of the US.
The suit said Darweesh held a special immigrant visa, which he was granted the day of Trump's inauguration on January 20, due to his work for the US government from 2003 to 2013.
Rep. Nydia Velazquez, D-New York, who had arrived at JFK by early Saturday afternoon to try and secure the release of the two Iraqis, railed against Trump's order and pledged continued action.
"This should not happen in America," Velazquez said following Darweesh's release. "One by one, street by street, if we have to go to court, we will fight this anyplace, anywhere."
'The executive order is unlawful'
The lawsuit said the US granted Alshawi a visa earlier this month to meet with his wife and son, whom the US already granted refugee status for her association with the US military.
The lawyers for the two men called for a hearing because they maintain the detention of people with valid visas is illegal.
"Because the executive order is unlawful as applied to petitioners, their continued detention based solely on the executive order violates their Fifth Amendment procedural and substantive due process rights," the lawyers argue in court papers.
The ban and its impact
Court papers said Customs and Border Protection authorities did not allow the lawyers to meet with the men and told them to try reaching Trump. Velázquez and fellow New York Democratic Rep. Jerrold Nadler said they attempted to speak to Darweesh and Alshawi at JFK's Terminal 4 earlier Saturday but were denied.
"When Mr. Darweesh's attorneys approached CBP requesting to speak with Mr. Darweesh, CBP indicated that they were not the ones to talk to about seeing their client. When the attorneys asked, 'Who is the person to talk to?' the CBP agents responded, 'Mr. President. Call Mr. Trump,'" the court papers read.
Doss, an attorney with the International Refugee Assistance Project, told CNN his clients knew they had to get to the US as soon as possible so they boarded the first flight they could.
Related Article: Iran on Trump's immigration order: Reciprocal measures will be taken
The two men had been allowed to make phone calls. They do not know each other, and it is unclear if they were held together or separately, or if they were kept in a holding cell, according to Doss.
"Our courageous plaintiff and countless others risked their lives helping US service members in Iraq. Trump's order puts those who have helped us in harm's way by denying them the safe harbor they have been promised in the United States," said Karen Tumlin, the legal director of the NILC.
The lawsuit was earlier reported by The New York Times.
Trump's executive order, titled "Protection Of The Nation From Foreign Terrorist Entry Into The United States," makes good on his longtime campaign promise to tighten borders and halt certain refugees from entering the United States.
The countries impacted are Iran, Iraq, Syria, Sudan, Libya, Yemen and Somalia, according to a White House official. It also caps the total number of refugees admitted into the United States during the 2017 fiscal year at 50,000, down more than half from the current level of 110,000.
"I am establishing new vetting measures to keep radical Islamic terrorists out of the United States of America," Trump said during the signing at the Pentagon. "We don't want them here."
An administration official told CNN if a person has a valid visa to enter the US but is a citizen of one of the seven countries under the temporary travel ban, then the person cannot come into the US. If the person landed after the order was signed Friday afternoon, then the person would be detained and put back on a flight to their country of citizenship.
Department of Homeland Security officials acknowledged people who were in the air would be detained upon arrival and put back on a plane to their home country. An official was not able to provide numbers of how many have already been detained.
After the federal orders were issued, the department said it "will continue to enforce all of the president's Executive Orders in a manner that ensures the safety and security of the American people.
"The president'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 president's Executive Order affects a minor portion of international travelers, and is a first step towards reestablishing control over America's borders and national security."