MIAMI — An Australian once held at the U.S. Navy base at Guantanamo Bay, Cuba, won a challenge Wednesday to his terrorism conviction before a military court.

The U.S. Court of Military Commission Review struck down the March 2007 conviction of David Hicks in a unanimous ruling that reverses what had been one of the government’s few successes in prosecuting prisoners at Guantanamo.

Attorney Wells Dixon said he immediately called Hicks’ attorney in Australia, where it was the middle of the night, to pass on the news to his client.

“David is aware of the decision and he is thrilled,” Dixon said. “He is free to live his life without this conviction hanging over his head.”

Hicks, 39, pleaded guilty to providing material support to terrorism. It was a plea bargain in which all but nine months of his seven-year sentence was suspended and he was allowed to return home by the end of that year.

In 2014, an appeal’s court ruled that material support was not a legally viable war crime for the special wartime court at Guantanamo known as a military commission. Prosecutors argued his conviction should still stand because he agreed not to appeal as part of the plea deal, an argument rejected by the U.S. Court of Military Commission Review. A Pentagon spokesman had no comment.

For Hicks, the decision is the end of an odyssey that began when he traveled to Pakistan in 2000, joined the militant group Lashkar-e-Taiba.

He later traveled to Afghanistan and attended a training camp run by al-Qaida.

His only real fighting experience was helping to guard a Taliban tank near the Kandahar airport.

He was captured by Western allies, turned over to U.S. forces and spent about five years at Guantanamo.