The 37-year-old man known only as M had been held under controversial anti-terrorism laws at the maximum security Belmarsh prison in South-East London.
His release came after Home Secretary David Blunkett lost a challenge at the Court of Appeal to a ruling by the Special Immigration Appeals Commission that the detention without charge or trial was unjustified.
The dramatic announcement came after a panel of judges headed by the Lord Chief Justice, Lord Woolf, ruled that SIAC’s decision was not defective and there was no prospect of a full appeal succeeding.
M’s solicitor, Gareth Peirce, said that she had telephoned his wife with the news.
“She has had so many disappointments up to this point.”
She added: “It’s seen as fundamentally unlawful and wrong for individuals to not be told the case against them and to be locked up indefinitely without trial.
“There is absolutely no doubt that the detainees and their families are now for the most part suffering every kind of psychiatric and psychological effect.
“There is no doubt that indefinite detention and a failure to inform people of the evidence presents the most Kafkaesque predicament in which it is most difficult for an individual to retain his sanity.”
M, who has the right to remain anonymous under SIAC rules, was the first of 13 people held under the Anti-Terrorism, Crime and Security Act to successfully appeal against his detention.
Ms Peirce said she did not understand why SIAC had decided to free M but dismiss the applications of the 12 other men being held without trial by the Government.
These are now expected to mount a legal challenge against their internment by appealing separately to the Court Of Appeal.
She said she had not yet thought about whether to sue the Government for compensation for M.
Lord Woolf heard the first one-and-a-half hours of the case in public on Wednesday before excluding not only the media and public but also the detainee’s own lawyers.
Wyn Williams QC, for the Home Secretary, asked for the case to go into camera because his argument involved matters of national security.
He asked the court to overturn a decision by SIAC that the Home Secretary had ordered M to be held at Belmarsh on “wholly unreliable evidence”.
Mr Williams said in open court that SIAC had accepted that M was a member of an extremist Islamic movement in Libya, had fought with fellow Mujahedeen in Afghanistan, had been involved in procuring arms to attack Colonel Gadaffi’s regime and had transferred money to Fahdal Saadi, who is suspected of having links with al Qaida.