City investigators released ­e-mails Friday from a politically desperate DA Charles Hynes blaming a wrongful murder conviction on an NYPD detective — whose cop brother just left behind a suicide note blasting the former prosecutor.

David Ranta was investigated by then-Detective Louis Scarcella and prosecuted by then-DA Hynes and convicted for the 1990 murder of a rabbi before Hynes asked a judge to overturn the conviction last year.

“During the course of the Ranta investigation, [we] uncovered some questionable conduct by former NYPD Detective Scarcella,” Hynes wrote in a groveling June 2013 letter addressed to The New York Times editorial board in an unsuccessful bid to win their endorsement.

“In announcing our decision to release Mr. Ranta, we made it clear that the decision was made in part because of the conduct of Detective Scarcella,” Hynes wrote in one of the e-mails, which were released by the city Department of Investigation.

Hynes blamed Scarcella’s shoddy police work for the wrongful conviction, and later opened an investigation into all of the detective’s homicide cases.

Scarcella’s younger brother’s body was found Thursday with a self-inflicted gunshot wound to the chest. He left a note that bashed Hynes for hanging his big brother out to dry.

“My brother’s a good man, a good detective . . . Hynes is a liar,” NYPD Officer Michael Scarcella, 50, wrote in the note.

Hynes is the focus of a DOI report that accuses the former top prosecutor of spending $1.1 million in asset forfeiture money on a political consultant, using his office e-mail and staff for campaign work, and chatting political strategy with a sitting judge.

The e-mails, released Friday and appended to the 27-page report, include Hynes insulting his opponents during his losing campaign to current DA Ken Thompson.

“Thompson is a typical Fed in an empty suit with no one there. [Fellow candidate Abe] George lied about his experience in the DA’s office. It was pathetic,” Hynes wrote in an e-mail to Judge Barry Kamins after a June 2013 debate.