Sam Hallam became one of the youngest victims of a miscarriage of justice on Wednesday when the court of appeal released him after he served seven years for murder.

Hallam, 24, emerged with his mother on to the steps of the high court, where, in front of a crowd of photographers, he was sprayed with champagne by the friends and supporters who have long campaigned for his release.

Hallam, of Hoxton, north London, was just 18 when he was jailed for life for the murder of Essayas Kassahun in a gang attack in October 2004.

The court of appeal is expected to quash his murder conviction on Thursday after the crown dramatically withdrew all opposition to his appeal.

The court heard Hallam was jailed as a result of a flawed investigation that failed to follow lines of inquiry and in which the Metropolitan police and the Crown Prosecution Service withheld evidence.

Outside the court, his mother, Wendy Cohen, said: “I am just shocked. I knew this would happen, he should never have been in there. My family has gone through hell, it is like we were all being tortured. Sam’s father killed himself while he was inside, all of us have suffered.”

Hallam’s release comes after a campaign run by friends and family and supported by the actor Ray Winstone.

Henry Blaxland QC, for Hallam, said: “Sam Hallam – and I put it boldly – has been the victim of a serious miscarriage of justice brought about by a combination of manifestly unreliable identification evidence … failure by police properly to investigate his alibi and non-disclosure by the prosecution of material that could have supported his case.”

Shortly afterwards, supporters and friends inside the court gasped as David Hannon QC, for the crown, announced: “We have given this anxious consideration for a long time, and again today, and we are not in a position to oppose the appeal.”

Hallam was one of two men convicted of the killing of 21-year-old Kassahun in a gang attack which was over within seconds on the night of 11 October 2004. The trial judge recommended he serve life with a minimum term of 12 years.

The only evidence against him was two supposed witnesses who claimed he was present at the murder, one of whom gave several different accounts. The second retracted his evidence at the trial.

There was no forensic evidence to link him to the scene, and under cross-examination the main witness, Phoebe Henville, admitted: “I just wanted someone to blame.”

The appeal was brought after the criminal cases review commission instructed an outside police force to investigate – something it only does in a handful of cases. The inquiry by Thames Valley police uncovered new evidence which showed the witness evidence was “so manifestly unreliable” that it should never have been put to a jury, the court of appeal was told.

Other new evidence included information from previously undisclosed police documents about another suspect, and evidence from Hallam’s mobile phone which suggested he was in the pub with his father on the night of the murder.

As the crown withdrew its opposition to the appeal, Lady Justice Hallett adjourned the hearing for a few minutes and asked Hallam if he needed time to compose himself. She then announced that he would be released on bail with almost immediate effect. Hallam was led to the court cells, from where, shortly afterwards, he emerged into the well of the high court and the embrace of his mother. As campaigners cheered and clapped, most in tears, he stared straight ahead, looking dazed.

His brother Terry Hallam, 32, said: “It feels amazing. I just want to get him back home. The first thing we are going to do is visit my dad’s grave together, he hasn’t been able to do that. We are all stunned, we knew it would happen but we didn’t think it would happen so suddenly.”

As Hallam was driven away, Paul May, who led the campaign to release him, said he was considering referring the case to the Independent Police Complaints Commission. “There’s a legal duty on the police to pursue reasonable lines of inquiry. They didn’t do it, they didn’t do their job,” said May.”Not only has an innocent man gone to prison, the perpetrators of this dreadful murder have largely escaped justice.”

Winstone criticised the police and demanded answers on Wednesday evening. He said there had been “an outrageous miscarriage of justice” on ITV’s Tonight With Trevor McDonald. “For me it is the disgraceful unprofessional action of the police involved in this case. Action that has caused a terrible stress within the family of the Hallams.”