A federal judge in Michigan ordered the release of about 100 Iraqi detainees Tuesday, blasting the government for submitting false statements and saying he plans to issue sanctions.

U.S. District Judge Mark Goldsmith said delays by the government in responding to court orders and producing documents in response to a class action lawsuit had "shattered" the families of detained Iraqis facing deportation.

"From the earliest stages of this case," he wrote, "the Government made demonstrably false statements to the Court designed to delay the proceedings."

The ruling is the latest in a series of judicial rebukes to the Trump administration's immigration policies, including this week's battle over the administration's new asylum policy.

Nahrain Hamama and her four children in their church near Detroit, Michigan. Nehrain's husband Usama "Sam" Hamama was detained by ICE along with approximately 100 other Chaldean Christians from Michigan in June 2017. Sam, who came to the U.S. as a child, was being deported for a decades-old criminal conviction. His family worried he could be persecuted for his faith if returned to Iraq. Rachel Woolf / ACLU

The American Civil Liberties Union of Michigan, which represents the Iraqis, has claimed that Immigration and Customs Enforcement lied to the court in order to keep the Iraqis in custody.

"Today's decision is about accountability," said ACLU senior staff attorney Miriam Aukerman. "Judge Goldsmith made it clear that ICE is not above the law."

The ACLU filed the suit in 2017 on behalf of about 1,400 Iraqis facing deportation. Most had either overstayed a visa or have a criminal conviction, some of which date back to the 1980s.

Iraq has historically refused to take back deportees from the U.S. who did not voluntarily agree to return. In early 2017, that policy shifted. Iraq accepted a small charter flight of Iraqis who were already in custody as deportees in exchange for being removed from President Trump's first "travel ban."

Preparing for further deportations, ICE then arrested about 200 more Iraqis, at least half of them in Michigan, many of them Chaldean Christians, a group that had strongly supported President Trump's election. But thousands of pages of government documents released last month indicated that the two countries did not have a clear pledge that Iraq would continue to cooperate.

Astevana Shaya, 28, of Sterling Heights, Mich., wears a Chaldeans Lives Matter T-shirt at a protest on June 12, 2017 in Sterling Heights, Michigan. The arrests of dozens of Iraqi Christians in southeastern Michigan by U.S. immigration officials appear to be among the first roundups of people from Iraq who have long faced deportation, underscoring rising concerns in other immigrant communities. Todd McInturf / Detroit News via AP file

That put the Iraqis in custody at risk of remaining detained indefinitely, the ACLU claimed, a violation of a 2001 Supreme Court decision. Attorneys for the Iraqis argued that unless the government could show they would be deported imminently, ICE should free the remaining detainees, some of whom have been locked up for nearly 18 months.

The government has maintained in court filings that Iraq is willing to play ball. ICE did not immediately respond to a request for comment from NBC News.

In his strongly-worded opinion Tuesday, Judge Goldsmith sided with the Iraqis. Any detainee who has been in custody more than six months must be freed within the next 30 days, unless the government can make a case for why an individual should remain detained. Even if released, they still face potential deportation.

Goldsmith also admonished the federal government, saying that sanctions were likely forthcoming.

"[T]he Government has acted ignobly in this case, by failing to comply with court orders, submitting demonstrably false declarations of Government officials, and otherwise violating its litigation obligations—all of which impels this Court to impose sanctions," Goldsmith wrote.

He pointed specifically to the toll detention has taken on families.

"Detention has inflicted grave harm on numerous detainees for which there is no remedy at law," he wrote. "Families have been shattered."

The ruling marks a victory not only for the Iraqis, but also for the integrity of the courts, said Kim Scott, a principal at Miller Canfield Paddock and Stone, which brought the case with the ACLU.

"The judicial system is premised on both sides putting their cards on the table," she said. "The government has been hiding the ball."

But, Scott added, it won't give her clients back the time that has passed.

"It's taken 18 months to get here," she said. "It's devastating. These are people's lives."