John Bunn, now 41, wept as he thanked a New York judge for exonerating him of the 1991 shooting of correction officer Rolando Neischer.
He was just 14 when arrested over the killing and spent 17 years in prison after being convicted of murder based on tainted evidence.
Mr Bunn, from Brooklyn, was released on parole in 2009 but continued to fight to clear his name.
He was cleared after a retired detective who investigated Neischer’s murder was accused of manipulating evidence, coercing confessions and giving misleading testimony in multiple cases.
Mr Bunn and his friend Rosean Hargrave, then 17, were convicted of killing Neischer on the testimony of lone witness Robert Crosson, another correction officer who survived the shooting.
The teenagers were placed in a photo line-up by detective Louis Scarcella, a disgraced former star detective whose casework has prompted a large-scale review by Brooklyn’s district attorney. Dozens of cases linked to Mr Scarcella are under investigation and several convictions have been overturned.
Brooklyn Supreme Court judge Shawn’Dya Simpson threw out Mr Bunn’s conviction in 2016 and ordered a retrial. On Tuesday, prosecutors announced they were dropping charges due to a lack of evidence, local media reported.
“They won’t admit and say that I’m an innocent man. But I’m an innocent man, your honour, and I have always been an innocent man,” a tearful Mr Bunn told the judge after she fully exonerated him.
“I thank you so much for what you have done for me in saving my life and my family’s life,” he added.
“It has been 27 years, I’ve been fighting for my life and I’ve been fighting for my innocence. It takes a courageous judge to make that happen.”
Addressing prosecutors, he said: “You all had the wrong man this whole time and you have [someone] out there running free. You had no right to do what you did.”
Mr Hargreave, whose murder conviction was thrown out in 2015, will also not face a retrial.
Mr Bunn’s lawyer, Glenn Garber, said the problems with the case against him “were very obvious”.
“There was no probable cause to make an arrest,” said Mr Garber, of the Exoneration Initiative, which provides free legal help to people wrongly convicted in New York.
Ms Simpson, visibly emotional as she cleared Mr Bunn, agreed.
“This case was tried… a jury was picked, testimony was given and it concluded all in one day,” she said. “I don’t consider that justice at all.”