The Court of Appeal has ruled the government acted legally by detaining 10 terrorism suspects without charge.
Security measures across the UK have been tightened since 9/11
The foreign nationals were challenging a decision made by the Special Immigration Appeals Commission that the government was right to hold them.
Their lawyers argued their arrests were based on information gained through torture at Guantanamo Bay, in Cuba.
Home Secretary David Blunkett said he was pleased with the ruling, but the men's solicitor called it "terrifying".
Some of the men have been held since December 2001 in Belmarsh prison, south-east London, and in a psychiatric hospital.
It is a fundamental duty of all courts to act as a bulwark against human
Amnesty International UK director Kate Allen
They were detained under the 2001 Anti-Terrorism and Security Act, which came into force after the 11 September attacks on the US.
The men's solicitor, Gareth Peirce, said of the court's decision: "It shows that we have completely lost our way in this country legally and morally," she said.
"We have international treaty obligations which prevent the use of evidence obtained by torture in any proceedings.
"What this judgement says by a two-one majority is that if it is obtained by agents of another country, and not procured or connived at by UK agents, it is usable without any restriction and there is no obligation on the secretary of state to inquire into the origins of it."
Amnesty International UK said the court's ruling would encourage other countries to obtain evidence through torture.
Director Kate Allen said: "It is a fundamental duty of all courts to act as a bulwark against human
Belmarsh Prison, where some of the men were held
"Today, the Court of Appeal has shamefully abdicated this most
"If there is sufficient evidence to warrant holding these individuals, they
should be charged with a recognisably criminal offence, and tried in proceedings
which fully meet international fair trial standards.
"Otherwise, they should be
Under the terrorism act's emergency powers, the government must show only that it has "reasonable grounds to suspect" that foreign nationals have links to terror, before issuing certificates to hold them.
The Special Immigration Appeals Commission (Siac) last October ruled there was "sound material" backing the view that the men were a risk to national security.
Last week, a cross-party group of peers and MPs said Home Secretary David Blunkett should end the detention of foreign terror suspects without trial "as a matter of urgency".
'Powers used sparingly'
Mr Blunkett said in a statement after Wednesday's ruling: "I am pleased that my decision to certify these individuals as suspected international terrorists who pose a threat to our national security has been upheld by the Court of Appeal."
He added: "The Anti-Terrorism, Crime and Security Act was introduced in response to the public emergency we face, in order that government can fulfil its primary obligation - to protect national security.
"I have used its powers sparingly and proportionately in only the most serious circumstances, to prevent foreign nationals who we believe are international terrorists, but are unable to deport, from remaining at large in
The detainees' case has been backed by civil liberties groups who have described Belmarsh as "Britain's Guantanamo".
Five of the prisoners said at the time of the Siac ruling that it marked "a new dark age of injustice".
Now after Lords Justice Pill, Laws and Neuberger rejected their case at the Court of Appeal, the detainees' lawyers are expected to take steps to take the case to the House of Lords.