CNN —  

A federal judge blocked the Trump administration Thursday from transferring to another country an American citizen who has been accused of fighting for ISIS and who has been held by US forces in Iraq for months.

The order, issued by Judge Tanya S. Chutkan, says the Department of Defense is “hereby enjoined from transferring petitioner from US custody.”

US government lawyers had entered a filing Tuesday, saying the government planned to transfer the detainee, identified in court documents only as John Doe, to the control of a foreign country, the name of which had been redacted.

The American Civil Liberties Union, which represents the detained US citizen, opposed the transfer and requested that Chutkan block it.

The ACLU praised the judge’s decision in a statement Thursday, saying the detainee’s transfer would have denied “him the opportunity to win his freedom from a US court.”

“The ruling is a victory for the rule of law,” ACLU attorney Jonathan Hafetz said.

On Friday the Justice Department informed the court that it plans to appeal the ruling.

A spokesperson for the Pentagon referred questions about the case to the Department of Justice.

In a sworn statement included in the government’s Tuesday filing, a deputy assistant secretary at the State Department argued that an order from the court prohibiting or delaying the transfer “would undermine the United States’ credibility with an important foreign partner that has agreed to this request regarding [redacted], including as a demonstration of its commitment to and value of [redacted] bilateral relations with the United States.”

The detainee is a dual US-Saudi citizen and has been held as an enemy combatant in Iraq since September, when he was turned over to American forces by a US-backed militia fighting ISIS in Syria.

US-backed fighters in Syria have captured hundreds of foreign fighters during their battle against ISIS. However the detention of US citizens has proven rare.

Gen. Joseph Votel, the head of US Central Command, which oversees US forces in the region, told Congress last month that the Syrian Democratic Forces currently hold approximately 400 foreign terrorist fighters.

On Thursday the Pentagon told CNN that one of those captured fighters was Mohammed Haydar Zammar, a Syrian-born German national linked to the 9/11 terrorist attacks.