The detainee found dead in a maximum-security cell at Guantánamo was a long-despairing Yemeni captive with a history of suicide attempts who at one time won a federal judge’s release order, only to see his case overturned on appeal and rejected by the U.S. Supreme Court.

The detention center on Tuesday identified the dead captive as Adnan Farhan Abdul Latif, in his 30s, held since January 2002 as prisoner No. 156.

He was found unconscious in his cell at the prison’s Camp 5 Saturday afternoon, the military said. Guards and military medical staff could not revive him. He was the ninth detainee to die in the 11 years of the detention center.

The military withheld Latif’s identity while the Naval Criminal Intelligence Service began an investigation and the Obama administration arranged to notify his family as well as Congress of the death.

Latif was not one of Guantánamo’s best known captives. He had never been charged with a war crime, and he was cast at best as an al-Qaida foot soldier in the Defense Department’s own military intelligence assessments obtained by McClatchy from WikiLeaks.

But his lawyers for years portrayed him as a pitiful prisoner — both in the media and in court documents — who frequently tried to kill or harm himself and spent long periods confined to the prison’s psychiatric ward.

A frequent hunger striker, he would smear his excrement on himself, throw blood at his lawyers, and on at least one occasion was brought to meet his lawyer clad only in a padded green garment called a “suicide smock” held together by Velcro, said attorney David Remes of Washington, D.C., who defended Latif as an unpaid volunteer.

Fellow pro-bono defender Marc Falkoff recalled Tuesday that in August 2008, “He was the guy that we tried unsuccessfully to get medical records for, and a blanket and mattress, after we found him lying on the floor of our interview cell, weak and emaciated.” That 2008 court effort failed. A judge found that the federal courts could not interfere with Guantánamo captives’ conditions of confinement.

Falkoff, now a Northern Illinois University College of Law professor, also included Latif’s “Hunger Strike Poem,” in a 2007 anthology, “Poems from Guantánamo: The Detainees Speak.”

“ They leave us in prison for years, uncharged,” it went. “ Because we are Muslims”

Pakistani security forces captured Latif near the Afghan-Pakistan border in late 2001, one of many men believed to be foreign fighters who were turned over to U.S. forces in Afghanistan.

Latif had maintained his innocence, consistently arguing he had suffered a head injury in a car accident as a youth in Yemen and left his impoverished homeland in search of charitable Muslim medical treatment and ended up in Afghanistan. U.S. District Judge Henry Kennedy ordered Latif’s release on July 21, 2010, in a 32-page order that ruled that the government had failed to show by a preponderance of evidence that the Yemeni man was part of al-Qaida or an associated force at the time of his capture.

The Justice Department, however, appealed and won a 2-1 reversal that set aside Kennedy’s release order.

The U.S. Court of Appeals for the District of Columbia Circuit gave the benefit of the doubt to government intelligence reports and ruled that Latif probably had sought military training in an al-Qaida camp. The ruling made it easier for the government to fend off Guantánamo habeas corpus petition by adopting a new, liberal standard for evaluating government evidence.

“This included information obtained in chaotic battlefield settings, unless there was clear evidence to the contrary,” says Andrea Prasow, senior counterterrorism counsel at Human Rights Watch, “effectively shifting the burden to the detainee to prove that the evidence was false or unreliable.”

In June, the Supreme Court chose not to hear the case. It was among seven Guantánamo detainee appeals that the justices rejected without comment.

Latif’s 2008 Defense Department risk assessment recommended he be transferred from Guantánamo as “a medium risk” who “may pose a threat to the U.S. its interests and its allies.” It said he had often violated the prison’s rules, “had been noncompliant and hostile to the guard force.” At the time of his death, the prison camps spokesman said, Latif had been in single-cell confinement with reduced privileges for hurling a container of his bodily fluids at a guard.

Even had the judge’s order been upheld, it was unclear whether Latif would’ve been repatriated.

Defense Department review panels as far back as 2004 recommended he be transferred, as did a Task Force set up by the Obama administration in 2009.

But Yemen is wracked by internal violence. Neither the Obama nor Bush administration have been willing to repatriate most Yemenis, even those cleared for release from Guantánamo, for fear they would be ripe for recruitment by Al-Qaida of the Arabian Peninsula, an offshoot of the terror group Osama bin laden founded. Yemenis represent more than half of the 167 captives currently held at the prison camps in southeast Cuba.

Military sources said that by Tuesday Latif’s remains were airlifted from Guantánamo for repatriation to his homeland. Even in death, the military and defense attorneys could not agree on the captive’s age. A military release said he was 32. Remes said court records indicated Latif was 36 when he died.