Photo: U.S. President Donald Trump speaks while signing executive orders at the White House in Washington January 24, 2017. Kevin Lamarque/Reuters

Legal challenges are already being presented to President Donald Trump’s executive order barring citizens and refugees from seven Muslim-majority nations, which took immediate effect on Friday and left refugees stranded or detained in airports across the country.

Among those refugees were two Iraqis with valid visas who had been granted asylum for their or their families’ work for the US government during the American occupation, which made them targets in their home country.

"Lawyers representing two Iraqi refugees held at Kennedy Airport filed a writ of habeas corpus early Saturday in the Eastern District of New York seeking to have their clients released," the New York Times reported on Saturday. "At the same time, they filed a motion for class certification, in an effort to represent all refugees and immigrants who they said were being unlawfully detained at ports of entry."

One of the Iraqis, Hameed Khalid Darweesh, had worked as an interpreter for the Army’s 101st Airborne Division in Baghdad and Mosul starting shortly after the Americans invaded in 2003, according to the Times. He was detained by customs and border patrol agents at JFK late Friday.

The other, Haider Sameer Abdulkhaleq Alshawi, was traveling to Texas to reunite with his wife and son when customs denied him entry, according to the Times. Alshawi’s wife had worked as a contractor for the US government in Iraq.

Five Iraqi passengers and one Yemeni, meanwhile, were barred from boarding an EgyptAir flight from Cairo to New York on Saturday, according to Reuters.

The US government implemented two programs — the Special Immigrant Visa program and the Direct Access Program for US-Affiliated Iraqis — for Iraqis who had helped the US government during the occupation.

Photo: refugees The offensive in Mosul drove an exodus of civilians from the latest frontlines in the war against Islamic State. Zohra Bensemra/Reuters

"A lot of translators were trying to get the hell out of there because they had a mark on their head for working with U.S. forces," Allen Vaught, a former US Army captain who was stationed in Fallujah in 2003, told Reuters. "They’re viewed as collaborators."

Trump’s ban on refugees and citizens arriving to the US from Iraq, Syria, Iran, Sudan, Libya, Somalia and Yemen has affected, among other things, the government’s asylum agreements with Iraqis who collaborated with the US during the war.

Citizens of Iraq, Iran, Sudan, Libya, Somalia and Yemen will be banned from entering the US for 120 days, according to the order, "to ensure that those approved for refugee admission do not pose a threat to the security and welfare of the United States."

But the ban on Syrians fleeing a brutal, six-year civil war is indefinite, even as nearly 15,000 Syrian asylum-seekers had been resettled in the US as of November. The ban gives priority status, however, to minorities fleeing religious persecution. Trump said in an interview on Friday that the caveat was aimed at helping Syrian Christians.

The order could also block half a million legal US residents who hold visas or green cards from returning to the US from trips abroad, prompting Princeton University to advise its students and staff who might be affected by the ban to "defer travel outside of the United States until there is some clarity and legal analysis of the situation, or, if they must travel, to seek legal counsel before they do."

The International Refugee Assistance Project (IRAP), which organizes law students and lawyers to protect legal and human rights for refugees and displaced persons, put out a call on its website last week for lawyers to travel to airports to offer legal advice to refugees arriving in the US who might be detained.

A representative for the project told Business Insider last week that they received a "great response," but that they were waiting to mobilize until it was clear that the refugees with valid visas would actually be denied entry.

A request for additional comment was not immediately answered, but the organization’s website has since been updated: "Hundreds of lawyers have signed up to help. We have reached capacity and have therefore taken down the sign-up form."