The administration has argued that military detainees in Afghanistan may not challenge their detentions in American courts. A federal judge ruled last month that some Bagram detainees captured outside Afghanistan had the constitutional right of habeas corpus, citing a Supreme Court ruling. But the new administration has appealed.

Captain Black’s involvement in the Bagram detainee’s case began in January, while the American officer was attending a meeting of village elders and leaders. He was approached by relatives of an Afghan named Gul Khan, who they said had been snatched by American troops in September and imprisoned at Bagram Air Field, north of Kabul. The military apparently believed Mr. Khan was a Taliban leader named Qari Idris. But local Afghan officials told Captain Black it was a case of mistaken identity. Captain Black, believing that he was fulfilling a policy of the American counterinsurgency by trying to hear out locals with grievances, applied his police training to the evidence he heard.

“Upon speaking to multiple village elders, family members, the police chief and the subgovernor, I am convinced that the individual in question is not the person that the government claims,” he wrote in January to Clive Stafford Smith, a human rights lawyer he had met three years earlier during a posting to Guantánamo. “I am a police officer in the United States, and there is a mass of evidence that this individual does not need to be held.”

Mr. Stafford Smith, who has agreed to represent Gul Khan pro bono through his brother Kala Khan and is filing a writ of habeas corpus in federal court, provided a copy of the correspondence.

Image Relatives of Gul Khan, an Afghan detainee, have insisted that he has no connection to the Taliban. From left are Mr. Khans cousin Qahir; his brother Kala; Capt. Kirk Black of the Army; and Gul Khans uncle Kheyal. Credit... Robert Nickelsberg/Getty Images, for The New York Times

It is impossible to be certain that Mr. Khan has no ties to the Taliban, who have been known to threaten villagers to lobby for captured fighters’ release. In a case last year, such efforts led to the pardon of an insurgent leader from northwest Afghanistan who immediately took up arms and killed a dozen members of the Afghan forces; he was killed by an American airstrike in February.