NEW YORK (CNN) - After more than two decades 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."
Hours later, his lawyer told CNN that Ranta intends to file a federal civil rights lawsuit against the city of New York and the New York Police Department.
"My client had 23 years taken from him. It is a lifetime, it's a generation," attorney Pierre Sussman said. "And if you look at those before and after pictures, before he went in, and now that he's out, it's a different person."
For now, Ranta plans to relax and reconnect with his family, Sussman said.
One of his first requests after leaving the courtroom, Sussman said, was "a juicy chicken parmesan sandwich with a side of fries."
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.
A key part of the investigation that led to Thursday's ruling started two years ago, when a witness in the case changed his story.
Menachem Lieberman was 13 years old when he identified Ranta in a lineup.
In 2011, he told investigators that he identified Ranta after being told by a detective to "Pick the guy with the big nose."
"I was too young back then to realize that this was a setup. To me this was just basically, I never saw a lineup before, I was just part of the process," Lieberman said in an exclusive interview with CNN's AC360 on Thursday. "I think as years went by ... as more and more I saw on the news, I saw innocent people get set free in various ways. I started to think back to the trial I was involved in, and remembered where I was told who to pick out of the lineup."
After Lieberman came forward, O'Mara's unit began to dig into Ranta's case.
"As he started to investigate, the whole case fell apart," Lieberman said. "So I guess an innocent man was in jail but is now free. The sad part is that the killer never met justice."
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, Lieberman came forward.
"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."
As O'Mara began to dig into the case, details unraveled. 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, Ranta's attorney, called the case "a travesty of justice from the beginning."
"The detective work that was done on this case was at best shoddy and at worst criminal. And I don't use that word lightly," he told CNN. "But when a closer examination is done of the detective work ... It becomes clear that there were so many leads that weren't followed, there were so many notes that weren't taken and just a general lack of attention to an investigation that required nothing but close scrutiny of the scene, of witnesses and so forth. That didn't happen."