Updated

A federal judge in Brooklyn, New York issued an emergency stay Saturday night that temporarily blocks the U.S. government from sending people out of the country after they have landed at a U.S. airport with valid visas.

The order barred U.S. border agents from removing anyone who arrived in the U.S. with a valid visa from Iraq, Syria, Iran, Sudan, Libya, Somalia and Yemen. It also covered anyone with an approved refugee application. The Department of Homeland Security said that more than 170 people were denied entry to the U.S. as of Saturday night, according to Reuters.

The ruling by Judge Ann Donnelly of the U.S. District Courtfor the Eastern District of New York came during a hearing called after President Donald Trump issued an executive order blocking people from seven Muslim-majority from entering the United States and putting a temporary halt to refugee admissions

Twelve refugees were detained at JFK Airport within hours of Trump's order restricting immigration from seven majority-Muslim nations -- but two were released later in the day -- as hundreds of protesters continued to amass at the busy airport throughout the day and into the evening.

One of the Iraqis, Hameed Jhalid Darweesh, 53, was released by midday Saturday. “I suffered to move here, to get my family here …. I can’t go back,” Darweesh said shortly after his release, according to the New York Post. Asked if he’d be killed in Iraq, he answered: “Yes, yes.”

refugee protesters

Protesters assemble at JFK Airport after two Iraqi refugees were detained. (AP)

Hameed Khalid Darweesh, an Army interpreter in Iraq, had been stopped as he traveled with his wife and three kids when agents pulled him aside, according to the New York Times.

The other Iraqi detainee, Haider Sameer Abdulkhaleq Alshawi, 33, was released at about 6:30 p.m. It was unclear how quickly the judge's order might affect people in detention.

Reps. Jerrold Nadler (D-Manhattan) and Nydia Velazquez (D-Brooklyn) announced the number of refugees held at the airport. “This should not happen in America. We shouldn’t have to demand the release of refugees one by one,” the two members of Congress said in a statement.

"They have been detained illegally. I am begging you to go and revisit this. It's ill-advised, it's mean spirited," said Velazquez, during a press conference.

Meanwhile, the National Immigration Law Center and other civil liberties organizations have filed a suit in federal court in New York on behalf of the two Iraqi men that seeks to certify the case as a class-action on behalf of other who organizers claim have been detained illegally. Karen Tumlin, legal director at the NILC, issued the following statement:

“Trump’s order keeps some of the world’s most vulnerable people in life threatening danger. ... Many refugees like our client risked their lives to help the United States government. The fact that the government has now decided to turn its back on those who served and protected us isn’t just unconscionable. It’s unconstitutional.”

Virginia Governor Terry McAuliffe (D) held an afternoon press conference in response to Trump's actions to say that we "cannot tolerate this type of activity."

British Prime Minister Theresa May has also criticized Trump's ban, her official spokesman said Sunday that May does "not agree" with the order and will challenge the U.S. government if it has an adverse effect on British nationals.

The official comment came after May refused to condemn the ban during a visit to Turkey to meet with Turkish leaders. She said in Turkey the decision was a matter solely for the U.S.

The White House moved Saturday to defend the president’s refugee order, saying Muslims are not being targeted.

“The notion that this is a ‘Muslim ban’ is ludicrous,” a senior administration official confirmed to Fox News.

In an interview with Fox News’ “Justice with Judge Jeanine”, former New York Mayor Rudy Giuliani defended the ban saying it was “perfectly legal, perfectly sensible.” Giuliani added that the ban is “not based on religion. It's based on places where there's substantial evidence that people are sending terrorists into our country.”

Other travelers were being stopped from boarding U.S.-bound flights at overseas airports as the Trump refugee ban went into effect Friday night.

Trump on Friday suspended refugee admissions for four months and indefinitely banned those from war-torn Syria, pending program changes that are to ensure refugees won't harm national security.

A U.S. federal law enforcement official says any non-U.S. citizen from Iraq, Syria, Iran, Sudan, Libya, Somalia or Yemen is now barred from entering the United States.

That covers legal permanent residents -- green card holders -- and visa-holders from those seven countries who are out of the United States after Friday, when President Donald Trump signed an executive order with the temporary ban. They cannot return to the U.S. for 90 days.

trump order

President Donald Trump signs an executive order on extreme vetting during an event at the Pentagon in Washington, Friday, Jan. 27, 2017. (AP Photo/Susan Walsh) (Copyright 2017 The Associated Press. All rights reserved.)

The official says there's an exemption for immigrants and legal permanent residents whose entry is in the U.S. national interest, but it's unclear how that exemption will be applied.

The official says visa and green card holders already in the U.S. will be allowed to stay. The official wasn't authorized to publicly discuss the details of how Trump's order is being put in place and spoke only on condition of anonymity.

Customs and Border Protection is notifying airlines about passengers whose visas had been canceled or legal residents scheduled to fly back to the U.S., and the airlines are being told to keep them off those flights.

The order also imposes a temporary ban on travelers from Iran, Iraq, Somalia, Libya, Sudan and Yemen.

The lawyers said custom agents wouldn’t let them meet with their clients who they said had valid visas to enter the U.S.

“Who is the person we need to talk to?” asked Mark Doss, a lawyer with the International Refugee Assistance Project.

“Mr. President,” the paper quoted a customs agent as responding. “Call Mr. Trump.”

“President Trump's war on equality is already taking a terrible human toll. This ban cannot be allowed to continue,” the group's Omar Jadwat said.

In Cairo, airport officials prevented seven U.S.-bound migrants -- six from Iraq and one from Yemen -- from boarding an EgyptAir flight to New York.

The officials said the seven migrants, escorted by officials from the U.N. refugee agency, were stopped from boarding the plane after authorities at Cairo airport contacted their counterparts at JFK.

Qatar Airways told passengers bound for the U.S. from the seven newly banned majority Muslim countries that they need to have either a U.S. green card or diplomatic visa to travel.

A statement on the company's website says: "Nationals of the following countries: Sudan, Libya, Somalia, Syria, Iran, Iraq, Yemen ... may travel to the U.S. only if they are in possession of a permanent resident card (Green card) or any of the below visas."

It listed foreign government, United Nations, international organization and NATO visas.

Late Friday, the International Rescue Committee called Trump's suspension of the U.S. refugee resettlement program a "harmful and hasty" decision.

The group’s president David Miliband said, "America must remain true to its core values. America must remain a beacon of hope."

He said the U.S. vetting process for prospective refugees is already robust -- involving biometric screening and up to 36 months of vetting by "12 to 15 government agencies."

“This is no time for America to turn its back on people ready to become patriotic Americans,” he said.

The Associated Press and Fox News' Wes Barrett contributed to this report.