After Aaron Salter was convicted of murdering a man he had never met, he immediately began trying to track down the real killer from behind bars. When another inmate described the crime in detail, Mr. Salter began investigating him. Eventually that other man signed an affidavit swearing that Mr. Salter was innocent.

Yet appeals courts refused to grant him a new trial.

Then, last year, his lawyers sent his file back to the Wayne County prosecutor in Detroit — the same office that had sent him away for life without parole in 2004 . This time, the file landed in the hands of the office’s new conviction integrity unit, which determined that the case against Mr. Salter had been based on mistaken identification by the prosecution’s only witness.

“Three months later, I was free,” Mr. Salter said.

The unit that exonerated him is part of a major shift in the role of some of the nation’s district attorneys, who have traditionally focused on sending people to prison. Now, a growing number of prosecutors are also working to get wrongly convicted people out.

Their efforts have provided an unflattering look at a system focused on winning convictions, sometimes with little apparent regard for a suspect’s actual guilt. In some instances, re-examining old cases has forced prosecutors to go up against their predecessors or their city’s police force, accusing them of wrongdoing or negligence.