NEW YORK (CNN) -- After nearly 22 years behind bars, David Ranta walked out of a Brooklyn courthouse Thursday afternoon with an apology from a judge and one immediate wish: "Get the hell out of here."
Ranta had been convicted of second-degree murder in 1991 for killing a rabbi during a botched diamond heist. But two decades later, a onetime witness said he had been coached into identifying Ranta in a police lineup -- and after an investigation, prosecutors recommended that Ranta's conviction be tossed out.
"Mr. Ranta, to say that I'm sorry for what you have endured would be an understatement and grossly inadequate, but I say it to you anyway," Judge Miriam Cyrulnik said during an emotional hearing that left even the judge wiping her eyes.
Asked what he wanted to do now, Ranta told reporters at the courthouse, "Get the hell out of here." And with that, he walked out with his lawyer, carrying a small mesh bag that held his belongings.
"Right now, I feel like I'm under water swimming," he said. "This is overwhelming."
Ranta, now 58, was sentenced to 37 1/2 years to life in prison in the killing of Chaskel Werzberger, a rabbi in Brooklyn's Williamsburg community.
Since Ranta's trial, another man's widow has identified her now-dead husband as the killer; a onetime jail inmate has said he made up statements about Ranta to boost his own fortunes; and the man who, as a boy, picked him out of a lineup has come forward to say he was coached by a detective.
Prosecutors have determined the evidence underpinning Ranta's conviction "has been degraded to such an extent" that it would no longer support the verdict, said John O'Mara, the deputy district attorney in charge of Brooklyn's conviction integrity unit.
Louis Scarcella, one of the detectives who investigated the case, told CNN that Ranta admitted his involvement in the heist attempt and that he stands by the arrest. As for claims that police coached a witness, he said, "No way that happened."
But O'Mara said the investigation found "a number of things that were wrong with the case."
"It was cumulative," he said. New evidence led prosecutors to believe "that we could no longer be confident" that Ranta was guilty beyond a reasonable doubt.
Isaac Abraham, a friend of the victim's, said he had sat through the trial and came away convinced that if Ranta had not been Werzberger's killer, "he was definitely an accomplice."
"Now it's David Ranta's day to suck in some fresh air and enjoy his free life out there," Abraham said. But he said the decision to release him left him "confused."
"Is the shooter still out there? We're pointing to a dead man to close the case? That's asinine," he said.
Werzberger died four days after being shot, a victim of the attempted holdup of a diamond courier. The courier escaped, but the would-be robber shot Werzberger through the window of his parked car, hauled him out of the vehicle and drove off, according to the Brooklyn district attorney's office.
Ranta was arrested six months later, when two men facing trial on their own robbery charges gave his name to police, prosecutors recounted in asking that his conviction be tossed out.
In an initial lineup, only one witness recognized Ranta, and that was after a lengthy conversation with a Yiddish interpreter, they noted. In the second lineup, three youths identified him and repeated that identification in court. One witness who didn't identify him was the courier, the intended target of the holdup.
When questioned by detectives, Ranta initially denied any involvement in the killing. Then he acknowledged knowing one of the jail inmates who identified him, according to prosecutors. He admitted he had been near the scene and knowing his friends had planned a holdup. Then he admitted he had been involved in planning the diamond heist, acted as the lookout and had seen the other men with the gun.
"The police had an alleged confession from him, but there was no physical evidence," Michael Baum, the lawyer who represented Ranta at his trial, told CNN. "The jewelry courier, he testified for the defense, saying that Ranta wasn't the guy."
Four years after Ranta's conviction, a woman named Theresa Astin came forward to say her husband had been the killer. Joseph Astin, who had died in a 1990 car accident, had been possible suspect before: Scarcella had brought the courier to the morgue in hopes that he could identify Astin as the gunman, but he couldn't.
Baum sought a new trial for his client based on the widow's testimony, without success. Then in 2011, one of the kids who picked Ranta out of a lineup got in touch with him. Menachem Lieberman later told investigators he identified Ranta after being told by a detective to "Pick the guy with the big nose."
"It was on his conscience for all these years," Baum said. "He was 13 years old at the time. He was just a kid. He was just doing what they told him to do."
Baum went to O'Mara's office, and O'Mara's recently created unit began to dig into Ranta's case. One of the two jail inmates who put the finger on Ranta had since died; the second told prosecutors he had fabricated earlier statements he made about Ranta, hoping that his cooperation would help his own criminal case. His girlfriend at the time confessed that her account was manufactured as well. And Theresa Astin reiterated her previous testimony.
Scarcella said the case against Ranta was "very simple," and he sharply disputes Lieberman's account of being coached.
"They're saying that I framed it," Scarcella said. "I want to go on record saying this: I never framed anyone in my life, and you would have to be a low, low devil to do something like that. I slept very good for the last 22 years."
But Sussman called the case "a travesty of justice from the beginning."
"My client's parents passed in the first year that he was incarcerated," he said. "His daughter, who is here today, who is six months pregnant, was 2 years old. And he is blessed, and we are so happy he is here with all of us now today."
CNN's Aaron Cooper, Raelyn Johnson and Laura Ly contributed to this report.