A photo taken in 2018 shows the main gate at the prison at the US Guantanamo Bay naval base in Cuba
A photo taken in 2018 shows the main gate at the prison at the US Guantanamo Bay naval base in Cuba AFP

A US military judge has reinstated plea agreements for 9/11 mastermind Khalid Sheikh Mohammed and two other defendants, an official said Thursday, three months after the deals were scrapped by Defense Secretary Lloyd Austin.

The agreements -- which are understood to take the death penalty off the table -- had triggered anger among some relatives of victims of the 2001 attacks, and Austin has said that both they and the American public deserved to see the defendants stand trial.

"I can confirm that the military judge has ruled that the pretrial agreements for the three accused are valid and enforceable," the US official told AFP on condition of anonymity.

The prosecution has the opportunity to appeal Wednesday's ruling, but it was not immediately clear if they would do so.

Pentagon spokesman Major General Pat Ryder said in a statement that "we are reviewing the decision and don't have anything further at this time."

The plea deals with Mohammed and two alleged accomplices -- Walid bin Attash and Mustafa al-Hawsawi -- were announced in late July.

The decision appeared to have moved their long-running cases toward resolution after years of being bogged down in pre-trial maneuverings while the defendants remained held at the Guantanamo Bay military base in Cuba.

But Austin withdrew the agreements two days after they were announced, saying the decision should be his given its significance.

He subsequently told journalists that "the families of the victims, our service members and the American public deserve the opportunity to see military commission trials carried out in this case."

Much of the legal jousting surrounding the men's cases has focused on whether they could be tried fairly after having undergone methodical torture at the hands of the CIA in the years after 9/11 -- a thorny issue that the plea agreements would have avoided.

Mohammed was regarded as one of Al-Qaeda chief Osama bin Laden's most trusted and intelligent lieutenants before his March 2003 capture in Pakistan. He then spent three years in secret CIA prisons before arriving at Guantanamo in 2006.

The trained engineer -- who has said he masterminded the 9/11 attacks "from A to Z" -- was involved in a string of major plots against the United States, where he had attended university.

Bin Attash, a Saudi of Yemeni origin, allegedly trained two of the hijackers who carried out the September 11 attacks, and his US interrogators also said he confessed to buying the explosives and recruiting members of the team that killed 17 sailors in an attack on the USS Cole in 2000.

After the US invasion of Afghanistan in 2001, he took refuge in neighboring Pakistan and was captured there in 2003. He was then held in a network of secret CIA prisons.

Hawsawi is suspected of managing the financing for the 9/11 attacks. He was arrested in Pakistan on March 1, 2003, and was also held in secret prisons before being transferred to Guantanamo in 2006.

The United States used Guantanamo, an isolated naval base, to hold militants captured during the "War on Terror" that followed the September 11 attacks in a bid to keep the defendants from claiming rights under US law.

The facility held roughly 800 prisoners at its peak, but they have since slowly been repatriated to other countries.

Joe Biden pledged before his election to try to shut down Guantanamo, but it remains open.