The first, and possibly the last, Guantanamo detainee to have a U.S. civilian trial was sentenced to life in prison Tuesday for his role in the 1998 U.S. embassy bombings in Africa, a case that nearly unraveled when the defendant was convicted on just one of more than 280 counts.

Ahmed Ghailani, who served as Osama bin Laden's cook and bodyguard after the bombings in Tanzania and Kenya, sought leniency, claiming he was tortured at a secret CIA detention site after his arrest in Pakistan seven years ago. But U.S. District Judge Lewis A. Kaplan imposed the maximum sentence, saying that whatever Ghailani suffered "pales in comparison to the suffering and the horror" caused by the nearly simultaneous attacks, which killed 224 people and injured thousands more.

Ghailani, 36, was convicted last month of conspiring to destroy government buildings. Prosecutors said he bought a truck used in the Tanzanian attack, stored and concealed detonators, sheltered an al-Qaida fugitive and delivered hundreds of pounds of TNT to the African terror cell.

His trial at a lower Manhattan courthouse had been viewed as a test for President Barack Obama's aim of putting other terror detainees — including self-professed Sept. 11 mastermind Khalid Sheik Mohammed — on trial on U.S. soil. His hands are tied, however — at least in the short term — because lawmakers have prohibited the Pentagon from transferring detainees to the U.S.

The prosecution of Ghailani is considered a success by supporters of civilian trials for detainees at the prison on the U.S. Navy base in Guantanamo Bay, Cuba. Critics, however, say it showed that such trials are too risky.

Attorney General Eric Holder said the sentencing "shows yet again the strength of the American justice system in holding terrorists accountable for their actions."

But House Judiciary Committee Chairman Lamar Smith, R-Texas, called the case "a near disaster" because Ghailani was only convicted of one of 285 counts.

Guantanamo once held nearly 800 detainees, mostly suspected militants captured in and around Afghanistan. Most have been released to other countries but about 170 remain. Five detainees have been convicted at Guantanamo through military tribunals.

Ghailani, wearing a blue dress shirt and showing no emotion, chose not to speak in the packed courtroom Tuesday. Before sentencing he bowed his head, closed his eyes and gripped the edge of the defense table with both hands as survivors and victims' loved ones spoke behind him — some in tears, many asking the judge to show no mercy.

"The pain is with me every day," said Sue Bartley, who lost her husband, Julian Leotis Bartley Sr., then U.S. consul general to Kenya, and her son, Julian "Jay" Bartley Jr. They were among 12 Americans killed in the bombings.

James Ndeda, a Kenyan who suffered a skull fracture and chronic eye and back problems in that country's bombing, said he "would sentence Ghailani to hell." As an alternative, he told Kaplan, "I believe one year for each death is a fair sentence."

In seeking a life sentence, prosecutors cited confessions — none heard by jurors — that Ghailani gave following his arrest in Pakistan in 2004 as proof he was a fixer for the al-Qaida cell that hatched the plot.

The defense said a harsh sentence would be unfair because Ghailani had been traumatized by the CIA's "enhanced interrogation techniques." They wrote, "Regardless of what euphemism is used, Ahmed Ghailani was tortured at the hands of the United States government."

Defense attorneys argued that Ghailani was a dupe for al-Qaida operatives. They admitted that Ghailani did chores for the plotters, but claimed he deserved leniency because he didn't learn about the goal of the al-Qaida conspiracy until after it succeeded — and was horrified by the results.

His lawyers cited his remarks at a military tribunal in 2007, when he said he was "sorry for what happened to those families who lost ... their friends and their beloved ones."

Defense attorney Peter Quijano argued that Ghailani also deserved credit for his cooperation, saying he had provided U.S. authorities with "intelligence and information that arguably saved lives, and I submit that is not hyperbole."

Prosecutors countered that Ghailani was aware of the plan well in advance, chose not to warn authorities and was worried most that one of the men would perish in the suicide attack.

According to an FBI summary of his confession, Ghailani said "all he could think about was that Ahmed the driver was going to die and the American embassy was the target."

Assistant U.S. Attorney Michael Farbiarz called Ghailani "a man who cannot muster a moment of contrition."

He said the attacks were "an act of horror and brutality and terror on a scale that is unfathomable, that words don't reach. ... In response to that, you should take away his freedom and take it away forever."

Prosecutors said Ghailani fled to Pakistan shortly before the 1998 bombings. After his capture, he was interrogated overseas at the CIA site as part of a now-defunct government program that used harsh techniques, including waterboarding, which evokes the sensation of drowning. Exactly what happened to him there remains classified. He was moved to Guantanamo Bay, Cuba, in 2006 before being transferred to New York for prosecution in 2009.

His trial demonstrated some of the challenges of civilian law and rules of evidence: Prosecutors chose not to use any statements Ghailani made to authorities after his arrest because his captors failed to advise him of his rights beforehand and denied him access to an attorney.

Before trial, the judge also barred prosecutors from calling as a witness the man who sold Ghailani explosives because the government had learned about him as a result of Ghailani's interrogation at the CIA facility, where defense lawyers said he was subjected to enhanced interrogation for 14 hours over five days.

After he fled, Ghailani ended up in Afghanistan, where he became both a bodyguard and a cook for Osama bin Laden. He told the military tribunal he also encountered Khalid Sheik Mohammed.

"In Afghanistan, I met them all," he said.

Ghailani is the fifth person to be sentenced for the embassy bombings. Four others were sentenced to life in prison after a 2001 trial in Manhattan federal court.

Ghailani was ordered to pay $33 million in restitution.