US government prosecutors must present evidence that an Algerian detainee held at Guantanamo Bay for over eight years truly belongs to Al-Qaeda or release him, a federal appeals court has ruled.

The decision by the US Court of Appeals for the District of Columbia has broad implications for the credibility of evidence the administration of President Barack Obama has presented to justify holding terror suspects without trial.

It also overturned a rare win for the government in Guantanamo cases, reversing a lower court's decision to uphold the detention of Belkacem Bensayah, who was nabbed from Bosnia with five other dual Bosnian-Algerian nationals in 2001.

The men, who were sent to Guantanamo in January 2002, were accused of planning to head to Afghanistan to fight US forces.

In a partially redacted 17-page ruling issued Thursday, Judge Douglas Ginsburg said "the evidence upon which the district court relied in concluding Bensayah 'supported' Al-Qaeda is insufficient... to show he was part of that organization."

Ginsburg's decision sent the case back before District Judge Richard Leon. In 2008, Leon ruled that Bensayah could be held indefinitely without trial, but also ordered the five other Algerians seized in Bosnia to be freed.

The group includes Lakhdar Boumediene, who was the named plaintiff in a key Supreme Court ruling issued earlier that same year that established Guantanamo detainees' right to contest their detention in US courts through the ancient writ of habeas corpus.

In his decision, Ginsburg set a looser standard for holding terror detainees than proving suspects actively supported Al-Qaeda. He said the Pentagon can hold suspects simply for being "part of Al-Qaeda."

But he said the US government had failed to meet even that burden of proof.

"The government presented no direct evidence of actual communication between Bensayah and any Al Qaeda member, much less evidence suggesting Bensayah communicated with" any other individual to help facilitate travel for an Al-Qaeda member, Ginsburg added.

Developments that followed Leon's ruling undermined it, the court said, pointing to the Obama administration's decision to drop an argument that Bensayah could be held because he had provided substantial "support" to Al-Qaeda.

The government instead opted for a narrower definition under which Bensayah was considered "part of" the group.

After Leon's ruling, the Obama administration also decided to eschew a claim that a "senior Al-Qaeda operative and facilitator" was a witness against Bensayah.

Though details about evidence were blacked out of the ruling, Ginsburg noted that "the evidence, viewed in isolation or together, is insufficiently corroborative" of claims that Bensayah was part of Al-Qaeda.

The United States transferred two Algerian detainees from Guantanamo Bay to their native country in January as Obama slipped past his self-imposed deadline for shuttering the notorious facility.

According to US government figures, 181 detainees remain at the US military prison in southeastern Cuba, including dozens already cleared for release. Most have been held without charge or trial.