A Manhattan man who was wrongfully convicted — thanks to a crooked cop and lying witnesses — is finally breathing free after serving more than 24 years in prison for a shooting he didn’t commit, he told The Post.

“It was so difficult for me to be in prison for so many years when I knew the case against me was totally fabricated,” Pablo Fernandez, 47, told The Post. “I survived because of my faith in God and because my family and my lawyers never stopped believing in my innocence.”

It was 1995 and Fernandez was just 22 when he was charged in the 1993 murder-for-hire slaying of gang leader Manny Quintero, 18, on a crowded Harlem street.

He was convicted in 1996 and handed a 25-to-life sentence.

But as a lengthy appeals process played out, witnesses and cooperators began to recant.

An appellate court finally overturned his conviction in February — after issuing a ruling related to the recantation of key witness Jesus Canela, who said he’d been coerced into falsely fingering Fernandez by corrupt cop Albert Melino.

Prosecutors at the time had failed to inform Fernandez’s defense lawyers that Melino — who was later fired by the NYPD — was under an active investigation for selling half a kilo of cocaine before joining the force, according to court papers.

After the three-judge panel tossed the conviction last February, prosecutors offered Fernandez time-served if he copped a plea to manslaughter.

He rejected the deal, insisting on his innocence and languishing in jail for six more months before a judge finally granted him $250,000 bail over the objection of prosecutors.

Fernandez posted and was released Aug. 2, but Manhattan Assistant DA Jeanne Olivo insisted that the case was strong and that prosecutors would retry it.

Finally, on Sept. 13, Olivo relented and asked Justice Curtis Farber to dismiss the charges due to a lack of evidence. The case was dropped and Fernandez walked out of court a truly free man.

It had been a long and costly battle for Fernandez.

After the verdict was overturned, it was clear the DA’s case had crumbled. Over the years, witness after witness had recanted as Olivo tried to explain away glaring inconsistencies.

Fernandez looked nothing like the eyewitness’ initial description of the shooter: A light-skinned man in his 40s with salt-and-pepper hair pulled back in a ponytail.

Fernandez, meanwhile, was 20 and dark-skinned with short, brown hair worn in a fade at the time of the killing. Prosecutors tried to account for this by arguing that Fernandez had donned a disguise.

Then two cooperators came forward two years after the murder and were offered deals to testify that Fernandez told them he had been hired to shoot Quintero.

Cooperator Raymond Rivera, who is now gravely ill, told jurors he was hanging out with a gray pony-tailed Fernandez in the days before the murder. After the daylight shooting, he said that Fernandez confessed.

But prosecutors recently discovered that Rivera was serving time in an upstate prison, six hours from New York, and was released the day of the murder.

The other cooperator recanted.

Three eyewitnesses, including Canela, also recanted and said Melino showed them a picture of Fernandez and told them to identify him as the shooter, according to court papers. A fourth eyewitness has since died.

Defense lawyers tracked down a second victim, Henry Gomez, who was wounded in the leg during the shooting and said that Fernandez was not the shooter. Authorities were unable to locate him before the trial.

Prosecutors quietly let the drug-dealing case against Melino languish for five years until it was dismissed in the 1990s, said Fernandez’s pro-bono defense lawyers from the white-shoe law firm Paul, Weiss, Rifkind, Wharton & Garrison.

“Our joy is bittersweet,” said defense lawyer David Brown. “The case against Mr. Fernandez was built from the beginning on police and prosecutorial misconduct, and perjury by government witnesses.”

Fernandez said that the greatest gift of his release was that his ailing mother got the joy of seeing the case against him dropped.

“It has been such a blessing for my mother, who is 83 years old, to see me as a free man again,” he said.

The DA’s office declined to comment.

Melino did not respond to messages seeking comment.

Additional reporting by Joe Marino