A US appeals court has thrown out the conviction of Osama bin Laden's former driver who served a five-and-a-half-year prison sentence for material support for terrorism.

In a 3-0 ruling on Tuesday, the court said the offence was not a war crime under international law at the time Salim Ahmed Hamdan engaged in the activity for which he was convicted.

He was sentenced in 2008, given credit for time served, and is back home in Yemen, reportedly working as a taxi driver.

"If the government wanted to charge Hamdan with aiding and abetting terrorism or some other war crime that was sufficiently rooted in the international law of war at the time of Hamdan's conduct, it should have done so," wrote Judge Brett Kavanaugh, who with the other two appeal judges were appointed by Republican presidents.

The war crime for which Hamdan was convicted was specified in the Military Commissions Act 2006.

"The government suggests that at the time of Hamdan's conduct from 1996 to 2001, material support for terrorism violated the law of war referenced," in US law, said Kavanaugh, but "we conclude otherwise".

To date, the cases against seven prisoners under the military commission system in place at Guantánamo Bay in Cuba have involved material support for terrorism. Five of those charged pleaded guilty. Hamdan went to trial, as did Ali Hamza al-Bahlul, who helped al-Qaida produce propaganda and handled media relations for Bin Laden. Bahlul was convicted in November 2008 of multiple counts of conspiracy, solicitation to commit murder and providing material support for terrorism, and is serving a life sentence at Guantánamo.

"It is highly likely that the result of this decision on Hamdan will be to vacate the convictions of Bahlul," said Eric M Freedman, a professor of constitutional law at Hofstra University, Long Island. "Even the conspiracy and solicitation to commit murder counts are very probably headed toward reversal."

A US justice department spokesman, Dean Boyd, said his department is reviewing the Bahlul ruling.

In 2006, Hamdan's lawyers successfully challenged the system of military commissions set up by George W Bush. That resulted in congressional enactment of the Military Commissions Act under which Hamdan was tried.

A six-member military jury in 2008 cleared Hamdan of conspiracy while finding him guilty of material support for terrorism.

The Centre for Constitutional Rights praised Tuesday's ruling but said the decision did not go far enough. The CCR says Guantánamo detainees are civilians under the laws of war and must be charged under domestic laws or released, rather than being tried under a system of military commissions.

Raha Wala, a lawyer for Human Rights First, said the case has repercussions for "every other flawed military commissions case like it", adding: "It's a basic rule of law principle that a defendant can't be prosecuted for acts that were not criminal at the time they were committed."

American Civil Liberties Union lawyer Zachary Katznelson said the decision "strikes the biggest blow yet against the legitimacy of the Guantánamo military commissions, which have for years now been trying people for a supposed war crime that in fact is not a war crime at all".

Hamdan met Bin Laden in Afghanistan in 1996 and worked on his farm before being promoted to his driver.

His lawyers said he only kept the job for the $200-a-month salary. But prosecutors alleged he was a personal driver and bodyguard of the al-Qaida leader. They say he transported weapons for the Taliban and helped Bin Laden escape US retribution after the 9/11 attacks.

Hamdan was captured at a roadblock in Afghanistan in November 2001.