An American illegally detained in Iraq by the U.S. military for more than a year has finally won his freedom.

On Sunday, after a long court battle, the Trump administration let our client go. Under a settlement agreement, he was released in a third country, where he will once again be a free man. Parts of the agreement are confidential, and he is officially remaining unidentified for his safety and privacy.

From the moment the American was imprisoned, his own government tried to deny him his constitutional rights. It kept his detention secret, denied his requests for a lawyer, and attempted to forcibly transfer him to a dangerous war zone.

Fortunately, the courts fulfilled their role and upheld his due process rights. What the Trump administration tried to do was unprecedented, and a series of historic court rulings forced the government to respect the Constitution at virtually every turn. The end result: Unwilling to justify our client’s detention to a court, the government had few choices but to set him free.

In September 2017, the American was fleeing violence in Syria, where he had traveled to research and document the ongoing conflict there. He was seized by Kurdish forces and handed over to the U.S. military, and the Trump administration labeled him an “enemy combatant” and held him without charges.

His story might have ended there, with him secretly detained indefinitely, if not for the reporting of The Daily Beast, which revealed his existence to the public.

Still, for four months, the government blocked the American’s access to a lawyer and the courts, despite his request for an attorney. The ACLU filed a habeas corpus lawsuit on his behalf in court in Washington, demanding that the government justify his detention and let him have an attorney. Over the Trump administration’s objections, we ultimately secured a court order enabling us to represent him.

Sunday’s release comes after months of continued litigation as we demanded that the government either charge or release our client. In response, the government claimed the power to imprison him indefinitely without charge, accusing him of being an ISIS fighter. Our client not only contested the allegations, but also maintained that the government had to prove its allegations in a trial if it wanted to continue holding him.

Instead of doing so, the government sought to transfer the American to the custody of a foreign country over his objection. In fact, the government said that it could spirit him away in the dead of night, without even informing the judge or his lawyers beforehand. But the district court rejected this assertion of unfettered government power over an American’s rights and blocked the government’s proposed transfer.

The Trump administration appealed, but the D.C. Circuit Court of Appeals rejected its arguments in a historic opinion in May. The court emphasized that what the administration sought to do was unprecedented, writing, “We know of no instance — in the history of the United States — in which the government has forcibly transferred an American citizen from one foreign country to another.” The court stressed that it is “vital” that judges “not give short shrift to the values that this country holds dear or to the privilege that is American citizenship.”

The case took another turn after the district court judge scheduled a hearing for June at which the government was supposed to defend its claimed power to hold our client indefinitely as an “enemy combatant.” To do that successfully, the government would have had to persuade the court that when Congress authorized the use of force against al-Qaida and the Taliban in 2001, it somehow also approved a war on ISIS in the mid-2010s — before ISIS even existed — and that our client was a member of that group.

But two weeks before the hearing, the Trump administration announced that it planned to send the American to Syria, which he had fled months before — abandoning him in one of the most dangerous places on the planet. The administration backed off after we immediately sought to block this cynical ploy in court.

With its options diminishing, the government began settlement discussions that led to Sunday’s safe release in another country, the name of which is not being disclosed under the terms of the settlement and to protect his privacy. There, our client will regain his freedom and focus on renewing his life.

The court never did rule on the underlying legality of our client’s military detention, but the litigation did force the government to justify to a judge its claims to broad detention authority, and its tenuous arguments were finally laid bare for the public to examine.

This case demonstrates that the president cannot take away an American’s liberty without due process, showing the continuing importance of judicial review. The landmark Supreme Court case vindicating the rights of another American citizen, Hamdi v. Rumsfeld, established that basic rule, but this one expanded it to mean that the government cannot render citizens to another country against their will — especially to places where they face further detention or risk to personal safety.

This case also illustrates the critical role that the press plays as a check against government abuse of authority. Without the original revelation by journalists about this American’s incommunicado and illegal detention, he might never have gotten his day in court at all.

The vitality of our Constitution depends on the determination of judges to protect individuals against government overreach. This should be the last time any administration attempts to deny an American’s basic rights.

Every day across the nation, the ACLU is called on to defend all the freedoms guaranteed in the Constitution and the Bill of Rights. There's never been a more important time for to support the ACLU and our effective work to protect civil liberties. If you like what you just read, help us continue to speak freely by donating today.