By Dominic Casciani
BBC News home affairs correspondent
Posing outdoors: Students said they were being silly; MI5 feared a plot
Two Pakistani men accused of planning a bomb attack in the UK have won their appeal against being deported - but only because the court said they might be tortured if they are returned home.
The ruling by the Special Immigration Appeals Commission comes a year after one of the most high profile and controversial counter-terrorism operations in the UK.
ARRESTS AND OUTCOMES
11 students arrested, 10 Pakistani, one British
All released without charge within two weeks
Pakistani men told they would be deported
Eight returned voluntarily, two remained
Appeals by two in UK and three in Pakistan
On 3 April 2009, after weeks of exhausting surveillance, MI5 officers and detectives thought they had a breakthrough.
Operation Pathway's prime suspect, Abid Naseer, was sitting in an internet cafe. He was at a keyboard and was seen sending an e-mail to his al-Qaeda contact in Pakistan.
"Hi Buddy," the e-mail read. "My mates are well and yes my affair with Nadia is soon turning in to family life.
"I met with Nadia family [sic] and we both parties have agreed to conduct the Nikkah [marriage contract] after 15th and before 20th of this month."
According to investigators, this e-mail was Abid Naseer's confirmation that a bomb attack was on. He had assembled his team, chosen his method of attack and was preparing for the operation.
Police arrested the alleged gang at addresses in Manchester, Liverpool and Lancashire, albeit earlier than expected because the plan was accidentally leaked by the officerin charge of the investigation, Assistant Commissioner Bob Quick.
Arrest: In broad daylight at Liverpool John Moores university
But the anti-terror officers encountered a problem - there was no bomb. And within two weeks, detectives had to throw in the towel and release all 11 men without charge.
But a year on from a PR disaster for the police, the Special Immigration Appeals Commission has ruled that four of the 10 Pakistani men were committed extremists.
It threw out their appeals against deportation after three weeks of evidence, much of it heard behind locked doors.
The story began in Pakistan's North West Frontier Province, the home of Abid Naseer and Ahmad Faraz Khan.
Faraz Khan's family sold land so that he could study for an MSc at a British university. Officially, Abid Naseer was helping Pakistani students settle in north-west England.
Abid Naseer: In prison under immigration powers; Deemed a threat, can't be deported
Faraz Khan: Bailed to a secret location; Deemed a threat, can't be deported
Tariq ur Rehman: Voluntarily returned to Pakistan; deemed a threat
Abdul Wahab Khan: Voluntarily returned to Pakistan; deemed a thraet
Shoaib Khan: Voluntarily returned to Pakistan; CLEARED of any involvement and wants to return to UK
But according to the security service witness, known only as officer ZR, Abid Naseer's real motive was terrorism.
He was enrolled at a bogus college and had allegedly assembled his cell in a series of meetings in Liverpool and Manchester.
"Abid Naseer and his associates were planning a terrorist attack in the UK that was being directed or orchestrated by al-Qaeda," officer ZR told the hearings.
"Part of the direction was through a series of coded emails and the most likely dates [for an attack] were between 14 and 20 April 2009, which is what led to the arrests."
"There is recognition that at the time of the arrests the appellants were not ready to mount the attacks, but it does not preclude them being ready for an attack after 15 April."
MI5 believed that Abid Naseer was using women's names in e-mails to refer to bomb materials.
But in tense courtoorm scenes, counsel for the students repeatedly attacked the assessment as a complete misinterpretation of reality.
They said that Naseer was desperate to find a wife and had been surfing dating websites.
One of the house parties watched by MI5 was said to have involved the group winding up Naseer over his attempts to find someone to marry him.
And during one of the hearings, a young Muslim woman gave evidence confirming that she had been in marriage talks with Abid Naseer.
It also emerged that a hiking trip to Wales had been initially flagged up as a potential jihadist bonding session. The men had taken silly photographs of each other flexing their muscles. The Home Secretary withdrew this element of the case.
But, overall, MI5 defended its conclusions. It said that although there had been insufficient evidence to convince a jury that a crime had been committed, it stood by its conclusions.
"This is possibly the most serious conclusion that we come to and it is not one that we have come to without rigorous analysis, or considering alternatives [that would have provided an innocent explanation]," ZR told the hearings.
One of the most significant meetings was a house party in late March 2009. The security service said that this gathering played a role in the plot - although little was said in open evidence about what had gone on.
Front: Ahmad Faraz Khan, one of the two men still in the UK
But the party's organiser, Ahmad Faraz Khan, said that it was laughable to label the party as a meeting of plotters.
In court, he was relaxed and said he was looking forward to resuming his MSc studies at Liverpool John Moores University. Speaking to the BBC before the verdict, he said that he just wanted to be a good son to his parents, using his Western education to become the breadwinner for the rest of the family.
But in the end, the court concluded he was a threat.
"In his witness statement, and in his descriptions of his early life in Pakistan, Faraz gives a convincing account," said the judgement. "If the conclusion which we have reached, that he was on balance of probabilities a knowing party to Naseer's plans, is right, he must have undergone a radical change of view between leaving home and arriving in the United Kingdom.
"For reasons which are largely set out in the closed judgement, we are satisfied that he must have done."
The future of both men is now legal limbo. Neither can be deported - but neither are they willing to leave.