After Terrance Lewis of Philadelphia had spent more than 12 years behind bars for a murder he did not commit, filing his own appeals and trying to win his freedom, a federal judge held an extensive hearing and in 2010 wrote: “the court believes that Petitioner is is more likely than not that no reasonable juror would have convicted Petitioner.”

Then the judge rejected Lewis’s appeal on procedural grounds, and returned him to prison to continue his life sentence without parole.

“That was a hard pull for me,” Lewis said recently. “I still had a chance to have a life and be a part of my son’s youth,” he said of the boy born a month after his arrest. “That also was taken from me. My reality was I still had to rot away in jail.”

In 2018, things began to change for Lewis. Longtime defense attorney Larry Krasner took over the Philadelphia District Attorney’s Office and relaunched its Conviction Integrity Unit, designed to revisit cases that may have been tainted by police or prosecutorial misconduct or flawed science. The unit is part of a growing wave in prosecutors’ offices nationwide, with 49 conviction review units now in place in district attorneys’ offices, most of them launched in the past five years, as well as statewide review offices in North Carolina, Michigan and New Jersey. Five other county prosecutors have announced recently they will join the list.

And last May, after more than 21 years in jail and prison, Lewis was freed, with the support of the prosecutor’s office that once sent him away. Since the beginning of last year, the Philadelphia district attorney has enabled 10 men wrongly convicted of murder to have their cases thrown out and be released from prison. In all, Conviction Integrity Units across the country enabled 344 exonerations through 2018, according to the National Registry of Exonerations.

“You take an oath to seek justice,” Krasner said. “That means innocent people go home. It also means, if you have an innocent person in jail, the guilty one got away.” He said his office had recently filed charges against new defendants in two cases that are roughly 30 years old.

Seven of the 10 men released in Philadelphia were convicted by longtime district attorney Lynne Abraham, a tough-on-crime prosecutor who regularly sought maximum punishments and death sentences. Abraham declined to comment on how her office convicted so many innocent men.

“The most powerful people in the criminal justice system are the prosecutors,” said Marvin Zalman, a criminal justice professor at Wayne State University who has written extensively about wrongful convictions. When DNA analysis started leading to exonerations in the early 2000s, prosecutors resisted any sort of systemic review of their cases, Zalman said. Now, with dozens of review units, “it’s a remarkable change. They have more of the ability to generate exonerations than the innocence organizations. They have the capacity to cut through the years of federal review, habeas review, the complexity of these cases. The ability of prosecutors is great.”

Some cities, such as Chicago and Philadelphia, have focused on corrupt cops who manufactured cases and won false convictions. Others, such as Houston, have cleared large numbers of cases by looking at flawed drug-testing systems that resulted in dozens of wrongful convictions.

The National Registry of Exonerations counted 165 exonerations last year, 69 of them in homicide cases, and found that the exonerees had spent a total of 1,701 years behind bars, or about 10 years per person. Conviction Integrity Units in prosecutors’ offices took part in 60 of those exonerations. The registry has tallied 2,500 wrongful convictions since 1989, costing defendants more than 22,000 years incarcerated.

“I was the 2,451st exoneree,” Lewis said. “How the hell? That’s an epidemic. That’s a problem.”

Some conviction units have yet to identify a case where the government got it wrong. In Washington, then-U.S. Attorney Ronald C. Machen Jr. announced a new Conviction Integrity Unit in 2014, with two attorneys assigned to investigate questioned convictions. The office has yet to enable the release of a single prisoner. U.S. Attorney Jessie K. Liu declined to comment on the unit’s work over the past five years. In Sacramento, the Conviction Integrity Unit launched in 2013 also has not produced any exonerations. Prosecutor’s office spokeswoman Shelly Orio said the unit had reviewed 41 convictions and had not yet found an innocent defendant.

Conviction Integrity Units aren’t new, but their number is growing rapidly. The first one was in Santa Clara County, Calif., in 2002, spurred by false convictions in sexual assault cases. Then in Dallas in 2007, District Attorney Craig Watkins is credited with being the first to actively pursue DNA-based exonerations, as awareness of false convictions grew. Barry Scheck and the Innocence Project, of which he is a co-founder, helped a number of prosecutors launch such units, as did the Quattrone Center for the Fair Administration of Justice at the University of Pennsylvania Law School.

“Every week I’ll get calls from DAs or innocence organizations around the country,” said Marissa Bluestine, the Quattrone Center’s assistant director. “It’s not just a flash-in-the-pan kind of thing. And it’s not just the ‘progressive’ DAs. Some have been in office for decades.”

The prosecutor-based units typically look only at cases that are submitted to them, whether from defense attorneys, groups such as regional Innocence Projects or the defendants themselves. In Philadelphia, Krasner recruited Patricia Cummings from a similar job in Texas to oversee his unit, which now has five full-time lawyers.

Cummings said her unit first makes sure the case is in their jurisdiction and then turns to the critical question: Did they do it? “Many are actually guilty,” she said. “We actually reject a lot of people at that stage, roughly 96 percent.” Since Krasner took office, the unit has reviewed and rejected more than 200 requests.

The process can be arduous, involving digging through old files from police, prosecutors, courts and defense attorneys, as well as tracking down and interviewing witnesses from cases that could be decades old. “We want to get our hands on everything that existed at the time,” Krasner said, while lamenting, “Everybody in Philadelphia has done a [poor] job of maintaining records. … Some of it is administrative failure. Some of it is covering tracks.”

Cases involving corrupt officers have set off a string of exonerations in Philadelphia. After longtime homicide detective Philip Nordo was accused of intimidating and sexually assaulting witnesses, defense attorneys began revisiting Nordo’s cases and sending them to the Conviction Integrity Unit. Three murder convictions worked by Nordo have now been vacated, and Nordo is in jail on sexual assault charges.

Jamaal Simmons had never been in trouble with the law until he was arrested for murder by Nordo in 2009, accused by a witness who claimed Nordo had threatened him and forced him to identify Simmons. “I thought people were going to go up there and tell the truth, and I’m going to be free,” Simmons recalled of his various hearings and trial. “When I got convicted, I was crushed. Sentenced to 15 to 30 years.” He was freed after nine years, and said Nordo “should rot in jail, the same way he had innocent people in jail.”

Krasner said there will be other cases involving corrupt cops. “I am aware that what is going to come out is that a short list of detectives are going to require systemic review of their convictions,” he said. “The volume will get bigger soon because of the systemic corruption in Philadelphia.”

Similarly in Chicago, cases handled by one officer, Sgt. Ronald Watts, have led to more than 60 exonerations of people whom Watts framed, stole from or extorted protection money from in the Ida B. Wells housing project. Cook County State’s Attorney Kim Foxx said her Conviction Integrity Unit has been able to not only free innocent people but maybe win a little credibility back for her office.

“For the people who lived in Ida B. Wells,” Foxx said, Watts’s criminal racket “was a known, open and notorious secret. Loved ones were in prison for crimes they didn’t commit. When they saw us acknowledging this didn’t happen, acknowledging the corruption in our system, it does start to produce a restoration of trust in the system.”

Foxx had been a prosecutor in the office before her election in 2016, and recalled that “60 Minutes” had done a story on Chicago “that declared us ‘the false confession capital of the U.S.’ It was very demoralizing for our line assistants to have such a mantle.” She said she made reinvigorating the Conviction Integrity Unit a part of her campaign platform. Her office has also stopped automatically opposing all convicts’ cases for commutations of long sentences, which she said gives her prosecutors more credibility with the state prison review board.

Expunging wrongful convictions is having a positive community impact in Houston, too, where prosecutors have exonerated more than 140 people mostly on drug charges, Harris County District Attorney Kim Ogg said. When Houston police were destroying old evidence files, prosecutors found that numerous defendants had pleaded guilty rather than wait for the results of drug tests — tests that found no drugs, but long after the conviction had been entered.

Most of the defendants hadn’t served more than a few months in jail, but the convictions “harm people’s employment opportunities,” Ogg said. “And that impacts crime, when people are not employed. My focus was to help get as many people back in the workforce as I could.” She said her staff has referred more than 2,600 drug cases to the Conviction Integrity Unit, which launched in 2008, for cases where no drugs were found or no lab report was done. Ogg has also changed her office’s policy and will not take guilty pleas until a confirmatory lab report is done.

Some expect another source of wrongful convictions will be when data about officers’ internal disciplinary histories is released. California has already begun to make such information public record. “Once we begin to find out about all the misconduct that has been hidden from the courts and prosecutors,” said Scheck, “with cops sanctioned internally for lying or sexual assaults, which is going to happen in a big way in California, we can completely transform the criminal justice system” by finding the basis for wrongful convictions.

Scheck said obtaining accountability for cops or prosecutors who enable wrongful convictions is hard but not impossible. In Texas, Michael Morton spent nearly 25 years in prison for the 1986 slaying of his wife, before DNA exonerated him. Defense attorneys later found that the prosecutor, Ken Anderson, had withheld key evidence from the judge and the defense. Anderson, who was a judge in 2013, was found guilty of contempt of court, served five days in jail and had to step down from the bench. Scheck said police officers who coerce confessions “are criminals. These guys should be in jail, and they should look at all the felony cases they did.”

There is also a push by innocence advocates for a “root cause analysis,” to find out why a wrongful conviction happened, as is done in the medical or transportation fields after disastrous events. No Conviction Integrity Units have a formal root cause process, Scheck said. Bluestine said such analysis can then lead to better policies and procedures in the future, such as improved eyewitness identifications and better interrogation procedures.

“This is a valuable opportunity,” Bluestine said. “If we don’t take that time and look at it holistically, we’re not going to prevent it in the future. Now we know how to do it right, making cases more reliable and accurate, doing interrogations that aren’t coercive but are getting reliable information. And that’s building community trust.”

Some of Philadelphia’s recently freed inmates are pushing to fix the system. “I just don’t want this to happen to anyone else,” said Simmons, an aspiring rapper who said he “missed 10 birthdays of my daughter” while behind bars. “I want people to wake up, particularly jurors. I want them to look at the person like it’s somebody in their family. It could happen to them also.”

Note: This story has been updated with more recent figures on the number of exonerations nationwide in 2018 and the number of years spent behind bars by those wrongly convicted.