The ruling is the first court-ordered release of Guantanamo detainees since the facility opened in 2002.

The Bush administration reacted with anger to the ruling, with a spokesman for the department of justice saying it presented "serious national security and separation of powers concerns and raises unprecedented legal issues".

The department said it would file an emergency request on Tuesday evening for a stay with the US court of appeals in Washington to halt the ruling.

If it loses, it has the option of appealing to the US Supreme Court, the highest in the country.

Lawyers 'thrilled'

Lawyers representing the men said they were "thrilled" with the decision.

"Justice has too long been delayed but ... we saw a great judge give a principled and just decision"

Sabin Willett, lawyer for some of the Uighur detainees

"Justice has too long been delayed but today we saw a great judge give a principled and just decision," Sabin Willett, a lawyer for some of the men, told Reuters news agency.

The Uighurs, from the Xinjiang province in western China, had been living in a camp in Afghanistan during the US-led bombing campaign in the country that began in October 2001 after the September 11 attacks in the US.

They fled into the mountains and were detained by Pakistani authorities, who handed them over to the US.

The men have been cleared for release from Guantanamo since 2004 as they are no longer considered "enemy combatants", the official designation for those held in Guantanamo Bay, and would have been sent home.

However, the US has not been able to find a country willing to accept them.

Many Muslim Uighurs seek greater autonomy for the region and some want independence, however China has waged a relentless campaign against what it calls their violent separatist activities.

About 265 detainees are still held at Guantanamo, which was opened in 2002 to hold suspects captured during the US's so-called "war on terror" launched after the September 11 attacks.

Most have been held for years without being charged and some allege they have been abused or tortured.