Two Libyan terror suspects have won a key legal battle against an attempt by the government to deport them.
They argued they could face persecution or torture on return to Libya. The government disagreed, saying a deal it signed with Libya in 2005 meant the men would be safe and their welfare would be independently monitored.
The two men are expected to be released from prison under highly restrictive bail conditions. The government intends to appeal.
SUSPECT ONE: DD
"DD" was born in 1975 and says he left Libya in November 2000, travelling through Tunisia, Turkey, Malaysia and reaching China in 2003, although security officials believe he has not told the full story.
He sought asylum in the UK in January 2004, along with his pregnant Moroccan wife. He was fraudulently using a Spanish passport in the name Abselam.
DD told the Home Office he had been an anti-Gadaffi campaigner - but he was initially refused refugee status. He was arrested as a security risk in October 2005.
According to the home secretary, DD is alleged to have been a senior member of the Libyan Islamic Fighting Group. The Islamist group says it seeks to overthrow Colonel Gaddafi.
But DD was allegedly supporting "a wide range of Islamist extremists loosely affiliated to al Qaeda networks who had been engaged in terrorist activity", including possible attacks in the UK.
Police found a road map in his car with markings drawn along footpaths under the flight path for Birmingham International Airport.
DD was related by marriage to a Moroccan man who blew himself up in a police raid on the suspected 2004 Madrid train bombers.
He was also related by marriage to another man jailed for his alleged role in the 2003 Casablanca bombings.
In a website designed by DD, the police say they found references to violence and "martyrdom" and a song whose title can be translated as "I am a terrorist".
In his defence, DD said the wrong interpretation was being placed on some of the words, such as martyr, which have acceptable religious meanings unrelated to terrorism.
The Special Immigration Appeals Commission concluded he was "a real and direct threat" to national security who could be shown to support suicide attacks.
SUSPECT TWO: AS
"AS" claimed asylum in the UK in April 2002 saying he faced persecution for his views. He said his brother had been tortured to death.
He says he was smuggled out of Libya in 1997 going first to Egypt and then on to Saudi Arabia. He then travelled through Syria so that he could seek asylum in Europe, eventually paying US$4,000 to smugglers to take him to the UK.
However, the home secretary disputed his story, saying he had spent time in Italy and the Netherlands and arrived on a false Italian passport, for which he was jailed for two months.
In December 2002, Italy sought his extradition on terrorism charges. According to the Italian authorities, AS received "terrorist training" in Afghanistan and was part of a Islamist cell based in Milan that was close to launching an attack somewhere in Europe in September 2002.
Evidence in the Italian courts linked AS to a larger conspiracy suspected of links to Al Qaeda and Mujihadeen figures hiding in Iran.
However, the case collapsed amid a complicated legal row, with London and Rome blaming each other.
AS is on a United Nations terrorist watch list and the Special Immigration Appeals Commission says he is "a clear danger to national security" who will resume terrorist planning "when he is able to do so."