A federal judge on Monday ordered the release of a former member of an elite Iraqi military force who was detained for 18 months by authorities who claimed he concealed his past as he sought protection in the United States.

Farass Adnan Ali, 34, of Rochester, came to the United States from Turkey as a refugee in January 2014 and in the next year was made a lawful permanent resident.

He has been held in the Sherburne County jail since a May 2017 arrest for a sexual assault charge that was later dismissed. Federal agents took him into custody, accusing him of lying about his service in the Iraq military as well as his social media activity.

In June and August 2017, the FBI notified federal immigration officials that "Ali would be considered a threat to security should he be released," according to a court record.

Ali and the Minnesota ACLU sued the U.S. Justice Department in September, arguing that he broke no law and was denied his due process rights.

"Ali is a refugee from Iraq who now is a lawful permanent resident of the U.S. Our government already has held Ali for 18 months, an unconscionably long time period. We agree with the court's decision that is 'unreasonably long' and is a clear violation of Ali's constitutional right to due process," said Minnesota ACLU attorney Ian Bratlie.

In his order on Monday, Judge David Doty said the federal government failed to prove that Ali was a threat.

"Ali has not been specifically designated a terrorist or a criminal," Doty wrote, ordering that Ali must be released within 30 days.

The Justice Department had previously petitioned to remove Ali from the country. That effort is ongoing in immigration court.

Until that case is decided, Bratlie said, Ali is a free man and will likely move back to Rochester where he hopes to get a job.

According to court records, Immigration and Customs Enforcement officials say Ali hid his service in the Saddam Hussein regime's elite Republican Guard and said that he had never been arrested in Iraq. But while later seeking refugee status, Ali claimed that he had once been arrested and interrogated by Iraqi authorities who suspected his involvement in an explosion targeting police.

Allegedly posed with guns

An FBI agent who interviewed Ali before his arrest wrote in his application to search Ali's phone that Ali told agents he did not use Facebook or an application called Viber to communicate. But an FBI interview with a friend who sponsored Ali's immigration bid refuted his claims, as did cellphone, Facebook and Viber records, the agent said. The agent said Ali's contacts on Viber included a fellow native of Fallujah, Iraq, also seeking refugee status and who is allegedly linked to an insurgent cell behind attacks on Iraqi and coalition forces.

Ali also posted images of a caravan of Islamic State of Iraq and Syria (ISIS) militants entering a Libyan city in 2015 and a photo of Ali posing in a sporting goods store alongside firearms for sale, according to a federal search warrant.

"Finally I found where they sell weapons and they are cheap! I swear to Allah!" he wrote on Facebook.

A spokesman for the FBI declined to comment. A spokesman for the Department of Justice replied in an automatic e-mail that because of the government shutdown he was out of the office until further notice.

Brandon Stahl • 612-673-4626