Shaurn Thomas had claimed for 16 years that he didn’t kill a popular Philadelphia businessman in a street robbery. He was 16 then, and said he had been at a juvenile court proceeding for trying to steal a motorcycle when the daylight slaying occurred. But the courts weren’t buying it, and Thomas lost appeal after appeal. Convicted almost completely on the testimony of a co-defendant, he was sentenced to life without parole.

Then in 2009, Thomas sent a letter to the newly formed Pennsylvania Innocence Project, and a lawyer named James Figorski happened to open it. Figorski had spent 25 years as a Philadelphia police officer. He knew how the city’s juvenile system worked, and he sensed something wasn’t right. For the next eight years, Figorski volunteered countless hours investigating Thomas’s case, along with Innocence Project legal director Marissa Bluestine, and last year they began meeting with the Philadelphia district attorney’s Conviction Review Unit. And the prosecutors agreed: Thomas was almost certainly innocent. On Tuesday morning, prosecutors moved to vacate Thomas’s murder conviction, and he was released from prison Tuesday evening after nearly 24 years behind bars. On Tuesday night, he had his “first meal” outside of prison, the seafood combination at Red Lobster, his lawyers said.

Thomas, now 43, was not in Philadelphia County court to hear the news. He remained in a state prison in Frackville, Pa., until the order from Judge Rose Marie DeFino-Nastasi was entered. Figorski drove up to Frackville on Tuesday afternoon to retrieve Thomas. The judge will hold another hearing next month, at which the prosecutors will announce whether they will retry Thomas, although that is not expected.

“At every level, Shaurn was failed,” Bluestine said. “By his lawyers, by the prosecutors, by the courts. Ironically, it took a former police officer to dig in and prove he’s an innocent man.”

“It happened because he had no money or power,” Figorski said. “They had a cold case they wanted to solve. And they had somebody willing to say [Shaurn] did it.”

The Philadelphia district attorney’s office had been under fire for having a conviction review unit that hadn’t overturned a single conviction since launching in 2014. District attorney Seth Williams reorganized the unit in February and put his chief of staff, Kathleen Martin, in charge. Thomas became the first person whose case was overturned, Martin said Tuesday. She said the unit’s staff and attorneys “spent a lot of time interviewing everyone associated with the Youth Study Center,” the juvenile facility where Thomas claimed he’d been at the time of the homicide, “and we also were looking at the recantation of one of the cooperating witnesses.” In the end, Martin said, “we concluded it was highly probable he [Thomas] was at the Youth Study Center at or about the time of the murder.”

Exonerations of people wrongly convicted continue to rise, in part because of the formation of conviction review units such as the one in Philadelphia. A record 166 people were exonerated in 2016, according to the National Registry of Exonerations, 52 of them for wrongful murder convictions. Seventy of last year’s exonerations emerged from prosecutors’ conviction review units. There are 29 such units nationwide.

Thomas was the fourth person convicted in the November 1990 slaying of Domingo Martinez, who owned three North Philadelphia travel agencies and was active with civic groups in the Latino community for decades. Martinez, 78, had gone to a Mellon Bank branch in Center City about 9 a.m. and withdrawn $25,000 in cash. After he drove away from the bank, his car was struck by another car, and someone in the other car got out, fatally shot Martinez and took the money.

The case was cold for two years, even though there were a number of witnesses, pedestrians and other motorists, who saw the collision and shooting. Then in 1992, a man named John Stallworth confessed to his involvement and named his brother and Thomas as participants. Stallworth’s confession was shown to be false because one of the other participants he named was in prison at the time of the slaying, but Stallworth still was held. In 1993, facing the death penalty, Stallworth changed his story and eliminated the man who was in prison. Thomas was arrested, charged with murder and jailed in July 1993.

Stallworth and his brother William cut plea deals in exchange for their testimony against Thomas and his older brother, Mustafa Thomas. Shaurn Thomas’s lawyer tried to present evidence of his alibi, his arrest and processing at the juvenile center, but “it wasn’t presented with the strength and detail that we have now,” Martin said. Thomas did not take the stand in his defense, and in December 1994 a jury convicted him of second-degree murder, which in Pennsylvania brings a mandatory life sentence without parole.

Thomas and his lawyer filed a series of state and federal appeals, which churned through the system for 15 years without success. In 2009, when the Pennsylvania Innocence Project was formed, Thomas tried them, too. His file wound up on Figorski’s desk.

Figorski spent more than two decades working narcotics for the Philadelphia force but also found time to go to law school. When he retired, Figorski joined the big Philadelphia law firm Dechert, and he also offered his services to the newly formed Innocence Project. He was helping weed out cases when he came across Thomas’s letter seeking help. Thomas claimed he’d been arrested in Center City for trying to steal a motorcycle Nov. 12, 1990, and was taken to a district station, booked and held overnight.

The process for juveniles in Philadelphia involves the Youth Study Center, which interviews arrested youths and their parents, sets a court date and gives them a subpoena. Figorski confirmed with some of his old police colleagues how the process worked: A teen was arrested and booked in a process that often took at least 12 hours, then released to a guardian with instructions to go directly to the Youth Study Center. Thomas said that’s where he was the morning of Nov. 13, 1990, when Martinez was killed, having been released from a holding cell to his mother, who took him directly to the center, Figorski said. Thomas had signed a subpoena at the center, but his lawyer didn’t have anyone to verify it at trial. Visitor logs to the center had been destroyed, Figorski said. The Innocence Project later hired experts to confirm that Thomas had indeed signed the subpoena at the center that morning in 1990.

Figorski became convinced that Thomas couldn’t have been at the youth center with his mother at 9 a.m., when intake interviews happened, and at the murder scene at 9:55 a.m. In looking at the trial record, Figorski realized that prosecutors had described one car to the jury in opening statements as the suspects’ car, then presented photos of a different car during the trial, after tests done during the trial showed the first car couldn’t have been involved. The tests weren’t turned over to the defense, Figorski said.

“I wanted to reach out to every witness,” Figorski said, digging deeper into the case. He tracked down Ron Smith, who had been driving immediately behind the red car that purposely crashed into Martinez, and watched as one of its occupants climbed out and shot Martinez. Smith said he sped off in his gray Chevy Nova. Police interviewed him, then told him his testimony wouldn’t be needed, and until Figorski located him, he thought the case had been unsolved.

Then in 2011, Bluestine visited William Stallworth in prison. He told her he hadn’t actually seen Shaurn Thomas at the scene because Stallworth hadn’t been at the scene. He lied at trial to help his brother avoid the death penalty, Bluestine said. William Stallworth was later denied parole because he refused to accept responsibility for the crime to which he’d pleaded guilty. And he had been the only witness to place Thomas at the murder scene at trial.

Thomas’s appeals in state and federal court were going nowhere. So Figorski and Bluestine began meeting with a prosecutor from the district attorney’s Conviction Review Unit in November 2016. Members of the unit reviewed the case and interviewed William Stallworth, who again recanted his trial testimony that Thomas had been involved in the homicide.

Shaurn Thomas’s brother Mustafa did not have similar appeal issues and remains incarcerated.

The prosecutors also found 36 pages of witness statements that had not been turned over to the defense during Shaurn Thomas’s trial, some with information implicating other suspects.

Figorski and Bluestine began meeting “pretty regularly” with the Conviction Review Unit beginning last year, Bluestine said, “to push them hard to look at this. We’ve never been afraid for them to look at the evidence because we knew he was innocent.”