David Ranta once worked as a printer, though he is not certain that such jobs exist anymore.

Mr. Ranta, 58, has spent the last 23 years living in maximum security prisons for a crime he almost certainly did not commit. He will be released from a state prison west of Buffalo on Thursday and flown to New York City, where a State Supreme Court judge will most likely declare him a free man.

Mr. Ranta was convicted in 1991 of shooting a Hasidic rabbi, Chaskel Werzberger, in the head following the botched robbery of a jewelry courier. He twice appealed his conviction, and each time prosecutors working for the office of the Brooklyn district attorney, Charles J. Hynes, convinced the courts to rule against Mr. Ranta.

No longer. After a yearlong investigation by the Conviction Integrity Unit of the district attorney’s office, the prosecutors have joined Mr. Ranta’s lawyer, Pierre Sussman, in asking the court to release the prisoner “in the interest of justice.” Prosecutors say new evidence creates “a probability that the verdict” in a trial would favor Mr. Ranta.

Specifically, a witness, Menachem Lieberman, as a 13-year-old, testified back then that he had seen Mr. Ranta sitting in a car near the murder site. But Mr. Lieberman, who now lives in Montreal, said he had been haunted for years by his action that day.