A British human rights organization, Reprieve, sought a writ of habeas corpus in the British courts on behalf of Mr. Rahmatullah. An American human rights organization, the International Justice Network, on whose board of directors I serve, sought a writ of habeas corpus on behalf of Mr. Ali in the United States courts. A bulwark against arbitrary or incommunicado detention since the 14th century, habeas corpus requires that the jailer produce the prisoner in court and provide the court with a legal justification for his continued custody.

In the sort of Catch-22 that happens daily in the world of detainee litigation, the British argued that habeas corpus did not apply because the government no longer held the prisoner and did not know whether it could get him back, despite its treaty rights. The American government claimed that habeas corpus did not apply because American courts had no authority over the Bagram base, as it was in a war zone, despite the fact that Mr. Ali had been flown into that war zone.

The English Court of Appeal has now ordered that the writ be granted and that the British foreign and defense secretaries produce Mr. Rahmatullah at the Royal Courts of Justice in London by Feb. 14 or be held in contempt. The order informs the cabinet secretaries that if they fail to produce him, the court will “be moved to commit you to prison for your contempt in not obeying the said writ.” (The American courts have not yet issued a decision in Mr. Ali’s case, and those of us representing him may file suit in Britain.)

The English court’s decision is a brave and serious attempt to halt America’s and Britain’s dangerous legal minuet. “Depriving a prisoner of war of the rights of fair and regular trial,” the court held, is a grave breach of the Geneva Conventions.

The Third Geneva Convention requires that prisoners of war be “released and repatriated, without delay after cessation of active hostilities.” As the Obama administration proudly announced in December, the war in Iraq is over. And that means all prisoners taken there must now be released.