Updated

A Guantanamo Bay prisoner who died in an apparent suicide had twice before tried to kill himself at the U.S. base in Cuba and had a long-term mental illness that predated his time in custody, his lawyer said Thursday.

One previous suicide attempt was so serious the prisoner nearly died, but he was saved by military doctors, attorney Paul Rashkind told The Associated Press.

"This was a young man who suffered significant psychosis, a paralyzing psychosis beginning many years ago, long before he got to Gitmo," Rashkind said in a phone interview from St. Louis.

The U.S. military said the 37-year-old Afghan prisoner identified as Inayatullah was found unconscious and not breathing Wednesday. Doctors attempted "extensive lifesaving measures" but could not revive him, the government said in a brief statement.

The prisoner apparently hanged himself with what appeared to be bed linen in an exercise yard of the detention center, a Guantanamo spokeswoman, Navy Cmdr. Tamsen A. Reese, told the AP.

Reese declined to discuss details about the detainee's death or medical history pending an investigation into the case by the Naval Criminal Investigative Service.

She said the prisoner did not have a history of disciplinary problems: "He was generally a compliant detainee."

It is unclear how he could have managed to hang himself without drawing the attention of guards. Five previous deaths were declared suicides at Guantanamo and there have been many attempts — or "self-harm incidents," as they are sometimes called by the military.

Rashkind said he was not permitted to provide details about either of the prisoner's previous suicide attempts, except to say both were serious.

"He was close to death the first time," said the lawyer, who is based in Miami but was traveling on an unrelated case.

Amnesty International urged the government Thursday to allow an independent, civilian-led investigation into the death.

Inayatullah had been held without charge at Guantanamo since September 2007, making him one of the last prisoners taken there. The military said he admitted planning al Qaida terrorist operations, and acknowledged facilitating the movement of foreign fighters.

The prisoner's real name was apparently Hajji Nassim and his lawyer said there was no evidence to support the allegations against him.

"I will tell you as far as I'm concerned he never did a violent act, he never planned a violent act," Rashkind said. "He was not a terrorist. His mental health issues made it difficult to address why he was there."

The prisoner finished school up to the fifth grade, was married and worked as a black market phone merchant in Iran before he was detained by the U.S. military, according to court documents.

Rashkind, who was still trying to contact family members in Iran and Pakistan to notify them of the death, said he was unable to discuss details of the case because some evidence is classified and U.S. government secrecy rules. He visited the detainee every three months, along with a Pashtun translator, and brought a forensic military psychiatrist to examine him. He last spoke to the prisoner two weeks ago by phone to discuss the status of the petition seeking his release.

The attorney planned to visit the prisoner again in June after a federal court hearing on his petition of habeas corpus.

"I can tell you he was fine at that time," the attorney said of his last phone call. "He seemed like he was doing well and he was looking forward to our visit that was coming up."

The military said the prisoner's remains would be treated with respect for Islamic culture and traditions with the assistance of a cultural adviser and that the body would be repatriated after the autopsy.

He was the eighth prisoner to die at the detention center since January 2002, when the U.S. began using the U.S. Navy base to hold captured detainees. Besides the deaths declared suicides, there were two from natural causes, including a 48-year-old Afghan who collapsed and died while exercising in February. The U.S. still holds about 170 men at Guantanamo.