Judge Neera Walsh last month ordered a new trial for 46-year-old Jacques Rivera after determining Orlando Lopez's recantation of his testimony against Rivera was credible.
After prosecutors admitted Tuesday they had little evidence to try Rivera again and dropped the charges, Walsh ordered the man released. Rivera was serving an 80-year sentence.
Lopez, then 12 years old, was the lone witness at Rivera's trial. He claimed he saw Rivera fatally shoot 16-year-old Felix Valentin in the summer of 1988.
Lopez, now 35, told lawyers from Northwestern University's Center on Wrongful Convictions he tried to tell authorities he identified the wrong man, but was ignored.
Family and friends joined Rivera in a prayer vigil outside the jail before they left. Rivera says his 21 years behind bars led him to religion.
"I'm not going to let bitterness rule my life, hatred rule my life," he said.
A former gang member, Rivera says he had already left gang life and was busy raising his family when he was charged with murder in 1988. He says he never had anything to do with the crime and lawyers from the Center on Wrongful Convictions believed him and took up the case.
"I thought, my goodness, this person shouldn't have been convicted in the first place," said Jane Raley, Rivera's attorney.
Rivera says he is not bitter. He now hopes to be able to help lead other kids away from gangs, drugs and violence. He also hopes to try to make up for lost time with his family.
"Them growing up. If anything, that's what I missed the most. Being a father to them," he said.
The oldest of Rivera's three children was seven when he first went to prison.
"It's been hard. Of course, you want mother and father together," said Jacque Rivera Jr., son.
"It's a dream come true," said Gwen Rivera, mother, in tears.
Rivera marveled at an iPad Tuesday night. When he went to prison over 20 years ago there were no personal computers, cell phones or any number of everyday conveniences taken for granted by ordinary citizens. But what Rivera plans to enjoy most is his freedom.
Rivera says prosecutors offered to let him go in the spring in exchange for time served several months ago. He says he refused that deal because he was innocent and he says he believes the family of the victim deserves to know the truth.
Prosecutors have not said whether they plan to pursue charges against anyone else.
The Associated Press contributed to this report.