WASHINGTON (Reuters) - Five of six Algerians held nearly seven years at the U.S. military prison at Guantanamo Bay in Cuba must be released, a federal judge ruled on Thursday in a setback for the Bush administration.

A guard tower of Camp Delta is seen at the Guantanamo Bay Naval Station in Guantanamo Bay, Cuba September 4, 2007. REUTERS/Joe Skipper

U.S. District Judge Richard Leon ruled from the bench after holding the first hearings under a landmark Supreme Court ruling in June that gave Guantanamo prisoners the legal right to challenge their continued confinement.

U.S. President-elect Barack Obama has promised to close the prison camp after he takes office in January. Meanwhile, U.S. judges in Washington are moving ahead with case-by-case reviews of about 200 detainee legal challenges.

Reading his ruling as the detainees listened in Guantanamo via a telephone hookup, Leon said the U.S. government failed to prove the five men who had been living in Bosnia had planned to travel to Afghanistan to fight against U.S. forces.

He ordered the U.S. government to take all necessary and appropriate diplomatic steps to facilitate their release “forthwith.”

There are about 255 detainees at Guantanamo, which was set up in January 2002 to hold terrorism suspects captured after the September 11 attacks on the United States by al Qaeda militants. Most have been held for years without being charged and many have complained of abuse.

The Algerians, who were picked up by Bosnian authorities in October 2001, were sent in January 2002 to Guantanamo and remain held there as “enemy combatants” without being charged.

U.S. President George W. Bush said in 2002 the six men had been planning a bomb attack on the U.S. embassy in Sarajevo. But Justice Department attorneys said last month they no longer would rely on those accusations to justify the continued detention of the six men.

However they argued the Algerians should be held because they planned to go to Afghanistan in late 2001 to fight U.S. forces.

CAN’T JUDGE SOURCE’S CREDIBILITY

In ordering the release of the five men, Leon said the allegation was based on only one unnamed source and he did not have enough information to judge the source’s reliability or credibility.

“To rest on so thin a reed would be inconsistent with this court’s obligation” to protect the Guantanamo detainees from the risk of erroneous or unlawful detention, Leon said.

He ruled the government did provide enough evidence that one of the detainees, Belkacem Bensayah, supported al Qaeda and planned to fight against the United States in Afghanistan.

The ruling was the second involving Guantanamo prisoners seeking their release and another Bush administration defeat.

Last month, U.S. District Judge Ricardo Urbina ordered the release of 17 Chinese Muslims, members of the Uighur ethnic group, after the government acknowledged they were not enemy combatants. Their release has been stayed, pending an appeal.

Leon, who was appointed to the bench by Bush in 2002, held hearings in November to consider the government’s factual basis for holding the six detainees. The hearings were closed because of classified evidence.

He was the first federal judge to hold a full hearing under habeas corpus -- a long-standing legal principle by which people can challenge their imprisonment -- in a Guantanamo case since the Supreme Court’s ruling.

The six Algerians were among the more than 30 Guantanamo prisoners who won before the Supreme Court. The five ordered released were Lakhdar Boumediene, Mohamed Nechla, Mustafa Ait Idir, Saber Lahmar and Hadj Boudella.

Nadja Dizdarevic, who is Boudella’s wife, told Reuters by telephone in Bosnia, “This is the victory of justice even though it comes after seven years of legal struggle.”

She said U.S. and Bosnian authorities must ensure that the five get back to Bosnia, instead of being extradited to Algeria, and must allow them to join their families.

Leon said the U.S. government can appeal his ruling on the five men, but strongly urged top administration officials to forgo an appeal that would take as long as two years.

Leon also cautioned that the case was “unique” and that “few if any” of the other detainee challenges were like it.

The White House said it disagreed with the portion of the ruling ordering the five men must to be released, but was pleased that one Algerian was affirmed as an enemy combatant and can continue to be held at Guantanamo.

White House spokesman Tony Fratto said the Justice Department was reviewing the decision on the five Algerians.

Justice Department spokesman Peter Carr said the ruling demonstrated the need for Congress to adopt procedures that are fair to the detainee, but allow “the government to present its case without imperiling national security.”