Five young men jailed by a judge who said they had become "intoxicated" by extremist propaganda were freed by the Court of Appeal today.
Lord Chief Justice Lord Phillips, sitting with two other judges, quashed their convictions and ordered their release.
Four of them, Bradford University students, were arrested after London Muslim schoolboy Mohammed Irfan Raja ran away from home in February 2006.
He left a note for his parents saying he was going to fight abroad and they would meet again in heaven, the Old Bailey heard last year.
The prosecution said they were all planning to go to Pakistan for training before going to fight jihad.
Raja, now 20, of Ilford, east London, and students Awaab Iqbal, 20, of Grove Terrace, Bradford; Aitzaz Zafar, 21, of Bishop Street, Rochdale, Lancashire; Usman Ahmed Malik, 22, of Laisteridge Lane, Bradford, West Yorkshire; and Akbar Butt, 21, of Southall, west London, who faced charges for having extreme material on their computers, were present in the dock of the court today for the ruling.
Raja was serving two years youth detention, Zafar and Iqbal had been given three years detention, Malik was sent to prison for three years and Butt was given 27 months' detention.
When sentencing, Recorder of London Judge Peter Beaumont said they were preparing to train in Pakistan and then fight in Afghanistan against its allies, which included British soldiers.
All denied having articles for terrorism and said the material, downloaded from various internet sites, was not intended to encourage terrorism or martyrdom.
They denied having extremist views and some said they were researching ideology and other matters.
Allowing their appeals today, Lord Phillips, sitting with Mr Justice Owen and Mr Justice Bean in London, said: "We do not consider that it was made plain to the jury, whether by the prosecution or by the Recorder, that the case that the appellants had to face was that they possessed the extremist material for use in the future to incite the commission of terrorist acts.
"We doubt whether the evidence supported such a case."