The brother-in-law of a Sept. 11, 2001, hijacker is expected to plead guilty Thursday to war-crimes charges during an arraignment at Guantanamo Bay, Cuba, and possibly agree to testify against another high-profile detainee at the facility, U.S. officials said.

The officials did not disclose the terms of the deal but said that Ahmed al-Darbi, 39, eventually would be allowed to return to his native Saudi Arabia. It is unclear how much longer Darbi will have to spend at Guantanamo Bay when sentenced.

The deal has been in the works for weeks as U.S. officials waited for Saudi Arabia to agree to take him when he is released.

Darbi is accused of helping plan a 2002 attack on a French oil tanker in Yemen that killed a Bulgarian crewman. The Saudi, who was captured in 2002, faces charges of terrorism and attacking civilians, among other war crimes.

He could be a key witness in the case against Abd al-Rahim al-Nashiri, who also has been charged in the bombing of the oil tanker and an attack on a U.S. warship in Yemen in 2000 that killed 17 sailors.

Darbi’s civilian attorney declined to comment.

If the plea deal is completed, Darbi will be the eighth person to be prosecuted successfully in the military commissions at Guantanamo Bay.

The plea deal would be a victory for the commissions, which have been beset with procedural delays and questions about the system’s legitimacy, including efforts to prosecute the group of alleged plotters who carried out the 9/11 attacks, led by self-professed mastermind Khalid Sheik Mohammed.

Darbi is married to a sister of Khalid Almihdhar, who helped hijack American Airlines Flight 77, which crashed into the Pentagon.

According to U.S. military files disclosed by the anti-secrecy group WikiLeaks, Darbi met Almihdhar in 1996 at a mosque in Saudi Arabia. Two years later, he married Almihdhar’s sister in Yemen.

The files say that Darbi had deep ties to al-Qaeda and spent time with Osama bin Laden in Afghanistan, attending training camps where he later acted as an instructor.

Prosecutors say Darbi met Nashiri in late 2000 or early 2001 and agreed to work for him. According to the charges, Darbi purchased boats that were intended for an operation to attack the oil tanker, then called the MV Limburg.

Darbi was detained in Dubai in June 2002. In October, the tanker was bombed using an explosives-laden boat.

Nashiri’s trial is scheduled to begin in September.

Julie Tate contributed to this report.