Image caption Mr Ghailani was captured in 2004 in Pakistan

The first Guantanamo detainee to be tried in a US civilian court has been sentenced to life in prison.

Tanzanian Ahmed Ghailani, 36, was found guilty in November of conspiracy to damage or destroy US property with explosives but was cleared of murder.

After Ghailani's acquittal on that and other charges, Congress barred US President Barack Obama from moving Guantanamo prisoners to the US.

The charges related to the 1998 bombing of US embassies in Kenya and Tanzania.

In New York on Tuesday, Judge Lewis Kaplan rejected Ghailani's request for leniency, saying any mistreatment he claimed he had suffered at the hands of his captors "pales in comparison to the suffering and the horror he and his confederates caused".

"This crime was so horrible," he said. "It was a cold-blooded killing and maiming of innocent people on an enormous scale."

US Attorney General Eric Holder said the life sentence demonstrated the ability of the US justice system to hold terrorists accountable for their actions.

"We hope this life sentence brings some measure of justice to the victims of these attacks and their families and friends who have waited so long for this day," he said in a statement.

Analysis While the conviction was not the resounding one the justice department would have liked, Ghailani's life imprisonment has been seized upon by the US Attorney General Eric Holder as showing the strength of the country's courts. But it's hard to see when the next civilian trial of a Guantanamo detainee will be, or indeed when President Barack Obama can close the Guantanamo Bay military prison. In the weeks following the Ghailani verdict late last year, Congress passed a law which prevented military funds from being used to transfer Guantanamo inmates to the US. This makes it practically very difficult for the Obama administration to empty the detention centre, and to move detainees and try them in civilian courts.

"As this case demonstrates, we will not rest in bringing to justice terrorists who seek to harm the American people, and we will use every tool available to the government to do so."

Ahead of the sentencing, Ghailani had asked for leniency, saying he had never intended to kill anyone and that he had been tortured.

In 2001 four co-conspirators were sentenced to life in prison over the August 1998 bombings, in which 224 people were killed.

Prosecutors said Ghailani had conspired with al-Qaeda operatives to bomb the embassies, and helped buy the explosives that destroyed the US embassy in Dar es Salaam, Tanzania.

US investigators said Ghailani had flown to Pakistan the night before the simultaneous bombings.

He was indicted in the US in December 1998 but remained at large in Afghanistan and the Waziristan area of Pakistan, the US says. He was captured in July 2004 and transferred to Guantanamo Bay in 2006.

Last year, the US stayed proceedings in a military tribunal at Guantanamo Bay and transferred him to New York for the civilian trial.