The 17 have been in Guantanamo Bay for nearly seven years
The White House has reacted angrily after a judge ordered that 17 Chinese Muslims held at Guantanamo Bay should be released into the United States.
District Judge Ricardo Urbina said the US could not hold the 17 as they were no longer considered enemy combatants.
The Uighurs were cleared for release in 2004 but the US says they may face persecution if returned to China.
The White House said the ruling could set a precedent that would allow "sworn enemies" to seek US entry.
The government says the 17 also pose a security risk if released into the US.
Lawyers for the Bush administration have argued that federal judges do not have authority to order the release into the US of Guantanamo detainees.
Analysts say the ruling is a rebuke for the US government and could set the stage for the release of dozens more detained at the military jail in Cuba.
Lawyers for the prisoners said it was the first time a federal court had ordered the release into the US of any Guantanamo prisoners.
Judge Urbina had presided over a hearing to consider appeals by the 17 who were seeking to be freed and allowed into the US.
They have been held at Guantanamo for nearly seven years.
The judge said there was no evidence that they were "enemy combatants" or a security risk.
Ethnically Turkic Muslims, mainly in Xinjiang
Made bid for independent state in 1940s
Sporadic violence in Xinjiang since 1991
Uighurs worried about Chinese immigration and erosion of traditional culture
"Because the constitution prohibits indefinite detentions without cause, the continued detention is unlawful," he said.
He ordered that they be brought to his courtroom for a hearing on Friday and he scheduled another hearing for the following week to decide where the Uighurs should be permanently settled.
Members of the Uighur community in the Washington DC area have offered to take them in.
The Washington DC courtroom was packed with dozens of Uighurs and human rights activists who cheered and applauded at the decision.
Justice department attorney John C O'Quinn's request to delay the detainees' release pending a possible appeal was denied by the judge.
White House spokeswoman Dana Perino said the ruling "could be used as precedent for other detainees held at Guantanamo Bay, including sworn enemies of the United States suspected of planning the attacks of 9/11, who may also seek release into our country".
Some detainees at the military prison fear torture or persecution if they return to their home countries, according to the New York-based Center for Constitutional Rights.
The Bush administration has maintained that if they cannot be returned home and no other country will take them, they should stay at Guantanamo.
The 17 Uighurs had been living in a camp in Afghanistan during the US-led military campaign that began in October 2001.
They fled into the mountains and were held by Pakistani authorities who handed them over to the US.
Beijing has demanded that all Uighurs held at Guantanamo be repatriated to China.
Many Muslim Uighurs from Xinjiang in western China want greater autonomy for the region and some want independence.
Beijing has waged a campaign against what it calls their violent separatist activities.