Detaining foreign terrorist suspects without trial breaks human rights laws, the UK's highest court has ruled.
Most of the men are being held at Belmarsh Prison
In a blow to the government's anti-terror measures, the House of Lords
ruled by an eight to one majority in favour of appeals by nine detainees.
The Law Lords said the measures were incompatible with European human rights laws, but Home Secretary Charles Clarke said the men would remain in prison.
He said the measures would "remain in force" until the law was reviewed.
Most of the men are being held indefinitely in Belmarsh prison, south London.
The ruling creates a major problem for Mr Clarke on his first day as home secretary following David Blunkett's resignation.
In a statement to MPs, Mr Clarke said: "I will be asking Parliament to renew this legislation in the New Year.
"In the meantime, we will be studying the judgment carefully to see whether it is possible to modify our legislation to address the concerns raised by the House of Lords."
Solicitor Gareth Peirce, who represents eight of the detainees, said: "The government has to take steps to withdraw the legislation and release the detainees."
If there was no swift government action, the detainees could ask the European Court of Human Rights to get involved, she added.
The Liberal Democrats say Mr Clarke should use the fact he is new to the job to take issue with a law established by his predecessor, David Blunkett.
The detainees took their case to the House of Lords after the Court of Appeal backed the Home Office's powers to hold them without limit or charge.
The government opted out of part of the European Convention on Human Rights concerning the right to a fair trial in order to bring in anti-terrorism legislation in response to the 11 September attacks in the US.
Any foreign national suspected of links with terrorism can be detained or can opt to be deported.
But those detained cannot be deported if this would mean persecution in their homeland.
On Thursday, Lord Bingham - a senior law lord - said the rules were incompatible with the European Convention on Human Rights as they allowed detentions "in a way that discriminates on the ground of nationality or immigration status" by justifying detention without trial for foreign suspects, but not Britons.
Lord Nicholls of Birkenhead, in his ruling, said: "Indefinite imprisonment without charge or trial is anathema in any country which observes the rule of law.
"It deprives the detained person of the protection a criminal trial is intended to afford."
But Lord Walker of Gestingthorpe, the one law lord to oppose the appeal, said the anti-terror laws contained important safeguards against oppression.
In a statement, detainee 'A' in Woodhill Prison said: "I hope now that the government will act upon this decision, scrap this
illegal 'law' and release me and the other internees to return to our families and loved ones."
The case was heard by a panel of nine law lords rather than the usual five because of the constitutional importance of the case.
Ms Peirce claimed the detention had driven four of the detainees to "madness", saying two were being held in Broadmoor hospital.
When the men were first held, they took their cases to the Special Immigration Appeals Commission (SIAC).
The commission ruled on 30 July, 2002 that the anti-terror act unjustifiably discriminated against foreign nationals as British people could not be held in the same way.
But that ruling was later overturned by the Court of Appeal who said there was a state of emergency threatening the life of the nation.