The directive for the release appears to have come from the Trump administration.
Haider Sameer Abdulkhaleq Alshawi, 33, was coming to the United States to join his wife, who had worked for a U.S. contractor, and young son in Houston, court documents reveal.
PHOTOS: Protests erupt over new immigration policy
If you're viewing on our ABC13 news app, tap on the photo above to see more images.
Alshawi was granted a Follow to Join Visa on Jan. 11 to rejoin them, both were granted refugee status due to their association with the U.S. Military, the lawsuit states. After going through a vetting process, the government deemed them both no threat to the U.S.
Alshawi was born in Baghdad and studied accounting at Baghdad University, graduating in 2006.
His wife and 7-year-old son lived and worked in the Houston area in 2014 after insurgents attempted to kidnap her brother. A month after that incident, an explosive placed on Alshawi's sister-in-law's car detonated, killing one and injuring a young child.
Another man, Hameed Khalid Darweesh, had worked on behalf of the U.S. government in Iraq for 10 years. He was released from detention early Saturday afternoon.
The men arrived on separate flights.
Their immigration attorneys filed a writ of habeas corpus Saturday morning in the Eastern District of New York seeking to have their clients released.
At a town hall meeting at the Islamic Society of Greater Houston, the president of the association reacted to Alshawi's detention.
"We really have to rethink, are we really doing this to control and make sure we're doing this so the bad guys don't come which none of us want but in the process are we hurting the good guys," said MJ Kahn.
Many at the town hall said their fear is not knowing what Trump's ban might mean for them or their families.
VIDEO: Houstonians protest immigration policy at Bush Airport
"I have some family worried if they can leave the country or if they would be able to come back in," said meeting attendee Nisha Quraishi.
Meanwhile, seven U.S.-bound migrants - six from Iraq and one from Yemen - have been prevented from boarding an EgyptAir flight to JFK airport.
Officials said the action Saturday by the airport was the first since President Trump imposed a three-month ban on refugees from seven Muslim-majority countries: Iraq, Syria, Iran, Sudan, Libya, Somalia and Yemen.
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 in JFK airport.
The airlines flying from this part of the world are updating their travel advisories to reflect the situation.
KLM and Qatar Airways are indicating that green card holders or holders of diplomatic visas (A,G, C-2 or NATO,) from the seven countries are allowed to fly. Tourists and those on study visas are not.
(The Associated Press contributed to this report.)