FORT MEADE, Md. (AP) — A Guantanamo Bay prisoner pleaded guilty Thursday to war crime charges in a pretrial deal aimed at limiting his sentence to 15 years for helping plan the suicide bombing of an oil tanker off Yemen in 2002 that killed a crewman and wounded a dozen others.

The deal was widely expected to give him time to testify against Abd al-Rahim al-Nashiri, who also faces terror charges in the tanker bombing and for allegedly orchestrating the 2000 al-Qaida attack on the USS Cole in the Yemeni port of Aden that killed 17 sailors and wounded 37.

READ MORE: Three Months After Their Daughter's Death, Maliyah Turner's Parents Are Still Seeking Justice

A military judge accepted the plea deal and found Ahmed al-Darbi of Saudi Arabia guilty of the five charges against him, including terrorism, attacking civilians and hazarding a vessel for complicity in the al-Qaida attack on the French-flagged MV Limburg.  Under the deal, the sentence could be capped if he cooperates with authorities.

Al-Darbi is a relative by marriage to one of the Sept. 11 hijackers who crashed a plane into the Pentagon. He’s been at the prison in Guantanamo Bay, Cuba, since August 2002; the attack actually took place two months later. But prosecutors said he was an al-Qaida operative who attended the group’s training camps and helped arrange the bombing by, among other things, buying small boats intended to be used to attack the tanker.

“Mr. al-Darbi was not present … did not actually physically take part in the attack,  but he is guilty” of the crimes under U.S. law because he aided those who did,  the presiding judge, Air Force Col. Mark L. Allred,  said as he repeatedly explained the law to al-Darbi. Speaking to al-Darbi through an interpreter, Allred said he couldn’t accept the guilty pleas until he was sure the accused completely understood them. The judge spent close to two hours going over the case — charge by charge — and questioning al-Darbi on them.

Flanked by his civilian and military lawyers, the 39-year-old al-Darbi wore a white dress shirt and a tie and repeatedly answered “yes, your honor,” sometimes in English and sometimes in Arabic, to signify his understanding to Allred.

“Do you understand that you are legally responsible for these actions?” Allred asked.

“Yes,” al-Darbi said.

Allred said al-Darbi’s sentencing would not be held for three and a half years.

If he complies with his part of the deal, his sentence could be limited to 15 years, minus the three and a half years that he will remain at Guantanamo Bay until sentencing proceedings.

“Following sentencing … it is possible Mr. al-Darbi will be repatriated to the Kingdom of Saudi Arabia to serve the remainder of his sentence to confinement in a Saudi Arabian prison,” chief prosecutor Mark Martins said in a statement released after the court hearing.

Allred said the plea deal also means al-Darbi  waived his rights to a trial and an appeal, that he won’t sue the U.S. over his capture, prosecution and confinement and that he will drop any lawsuit he may have pending.

READ MORE: Members Of Safe Streets Plan To Honor DaShawn McGrier On Saturday

Thursday’s ruling gives al-Darbi at least a little more certainty about his future, said his civilian lawyer, Ramzi Kassem, a longtime critic of the Guantanamo prison and the military tribunal system there that consigned men to indefinite imprisonment.

“This is neither the time nor the place to comment on the fairness of the military commissions or on their legitimacy,” Kassem said in a statement, noting al-Darbi had spent “twelve long and painful years in captivity.”

“What took place … today grants Mr. al-Darbi a measure of certainty that his ordeal will end in the foreseeable future,” said the law professor at City University of New York who has also represented other Guantanamo prisoners.

The arraignment was in Cuba but was viewed by some journalists via closed circuit at Fort Meade military base near Baltimore.

Prosecutors said that from 1996 to mid-2003, al-Darbi associated with members of al-Qaida including al-Nashiri and former head Osama bin Laden.

Al-Darbi bought the boat that was loaded with explosives and detonated alongside the Limburg, prosecutors said. In addition to admitting to that Thursday, al-Darbi’s plea agreement also acknowledged that he had obtained visas for the Yemeni attack operatives, helped trained them and hired the boat crew, among other things.

Al-Darbi was captured at the airport in Baku, Azerbaijan in June 2002. Several weeks later, he reportedly was taken blindfolded to the U.S. base in Bagram, Afghanistan, through which many if not most of the Guantanamo detainees have passed.  Before being transferred to Guantanamo, he says he was tortured at Bagram — was kicked and dragged around a room by U.S. troops while music blared in the background; was forced at times to kneel with his hands cuffed above his head through the night and was repeatedly interrogated, often while hooded. He also describes a process in which he was hooded, shaken violently and subjected to water poured over his head.

Thursday’s development represents the sixth time there has been a plea agreement with a detainee at Guantanamo Bay, which was opened in 2002 to hold terrorist suspects captured in what was originally then called the global war on terror.

In 2009, on the second day of his presidency, President Barack Obama ordered the detention center to be closed within one year, but opponents in Congress refuse to let the detainees come to the U.S. for trial, citing security risks to Americans. Lawmakers also have blocked the transfer and resettlement of some detainees to other nations, fearing they will return to terrorist havens upon their release.

There are 155 detainees held there now, down from a peak of about 660 a decade ago. Most were tried, transferred or cleared for release under President George W. Bush.

MORE NEWS: With Dangerous Wind Chill, Baltimore City Under Code Blue Extreme Cold Alert

(Copyright 2013 by The Associated Press. All Rights Reserved.)