Three British residents held by the US at Guantanamo Bay have won permission to seek a High Court order requiring the UK to petition for their release.
Hundreds of people have been held at Guantanamo Bay for three years
A judge said claims of torture at the camp meant the government might have an obligation to act on their behalf.
But there were "formidable arguments" against Bisher al-Rawi, Jamil el-Banna and Omar Deghayes's case, he added.
The UK government had contended it cannot represent non-British citizens at the camp - thought to number nine.
"It is only through the medium of their nationality that persons can seek to enjoy the obligations placed on a state by international law," said the government's counsel, Philip Sales.
Lawyers for the men want the High Court to order Foreign Secretary Jack Straw to request their return to the UK.
The men's families living in the UK filed evidence of distress they say they are suffering while their loved ones remain detained.
Rabinder Singh QC, for the families, said the UK and the European Court of Human Rights in Strasbourg would "undoubtedly condemn" many of the practices at Guantanamo Bay.
The judge Mr Justice Collins remarked during the hearing on Thursday that the US' idea of torture: "Doesn't appear to coincide with that of most civilised countries."
Speaking after the case, the men's solicitor Gareth Peirce said: "This is the first ray of light that we have had - the first ability to hope that this might be the beginning of the end for the ordeal of these three families."
Human rights' group Amnesty International says the men at the camp in Cuba, where around 500 prisoners are held, have been UK residents in the past, although no UK nationals are now held there.
Amnesty says the government's "reluctance" to act on behalf of these residents is "shameful" and the men are "forgotten prisoners".
Lawyers for the men earlier welcomed a United Nations report calling for the US detention camp to be closed.
The UK residents want the Foreign Office to act on their behalf
The report, which the US has largely rejected, says some aspects of the inmates' treatment amounts to torture.
It said the US should try all inmates or free them "without further delay".
The UN also called for the US government to refrain from any practice "amounting to torture or cruel, inhuman or degrading treatment".
Lawyer Clive Stafford-Smith, a British human rights lawyer based in the US, said: "The question now is whether the Bush administration are going to listen or do what we have always seen and bluster against the UN.
"The UN mentions in their report the coercive and violent way the US military is force-feeding people."
He said he had witnessed this himself when he visited a client at the camp.
Following the UN announcement on Thursday, the US said the five investigators had refused invitations to visit the camp.
It said the report's conclusions were "largely without merit and not based clearly on fact".
The UN investigators said they had refused to visit the naval base because the US would not allow them to interview detainees.
Meanwhile, the shadow home secretary William Hague is due to tell a Washington think tank that allegations of prisoner abuse undermine America's standing in the world.
Mr Hague will tell the Johns Hopkins SAIS Center for Transatlantic Relations in Washington DC that reports of prisoner abuse by US and British troops, however isolated or inaccurate, "have led to a critical erosion in our moral authority".