In the 37 years since Willie Stokes was tried for murder, the star witness against him has insisted that his police statement that Stokes had confessed to him was a lie, extracted by Philadelphia homicide detectives who threatened him and bribed him with sex and drugs.

Now, the Philadelphia District Attorney’s Office has conceded that prosecutors at the time not only were aware of the lie — but also had failed to disclose to the defense that they charged that witness, Franklin Lee, with perjury.

So, on Thursday, the DA dropped all charges against Stokes, whose conviction was vacated in federal court in December after a judge found that the suppressed evidence “fatally undermines confidence” in the murder conviction.

“After a thorough and independent review, the federal court determined that Mr. Stokes was the victim of an egregious violation of his constitutional rights, and we are convinced that the federal court’s ruling was correct,” said Matthew Stiegler, supervisor of the DA’s federal litigation unit.

Stokes’ conviction — for the 1980 fatal shooting of a young man, Leslie Campbell, during a dice game on a North Philadelphia street — was highlighted last year as part of The Inquirer’s “Losing Conviction” series on homicide cases tainted by allegations of police misconduct.

At a previous hearing, the sole surviving victim of that shooting, Francis Dinkins, had testified that Stokes was not the shooter. However, the DA and courts did not express an opinion on whether Stokes was actually innocent, instead focusing on the prosecutors’ alleged illegal concealment of evidence.

“This remarkable case is marked by prosecutorial and policing practices that were too pervasive during the so-called tough-on-crime 1980s and 1990s, and unfortunately persist in far too many jurisdictions today,” District Attorney Larry Krasner said in a statement earlier this month.

» READ MORE: Informants say cops traded sex for lies in murder cases

Stokes and his family, including his mother, Gloria Williams, 80, piled out of the courtroom Thursday in a rush of relief, giving thanks to Common Pleas Court Judge Lillian Ransom and to God. Stokes, who was released from prison earlier this month, said he’s still processing the news and the changed world he has encountered: houses where vacant lots used to be and tricky car door locks that don’t work like the ones he remembers. His lawyer Michael Diamondstein said the next task was to help Stokes establish an email address.

Stokes also filed a civil lawsuit Thursday against the City of Philadelphia, two former prosecutors, and the estates of two deceased homicide detectives.

“This is some of the most egregious misconduct I’ve ever seen,” said Josh Van Naarden, who filed the suit on behalf of Stokes, noting that Stokes has served more time in prison than any exoneree in Pennsylvania history.

The lawsuit is one of several civil rights claims filed in recent months by exonerees seeking to pierce a prosecutor’s shield of absolute immunity by arguing that prosecutors overstepped their designated role in handling the case.

» READ MORE: Case tainted by 'sex for lies' scandal is vacated after 37 years

Stokes alleged that then-Assistant District Attorneys John DiDonato and Robert Marano “stepped outside the bounds of their prosecutorial power and into the shoes of an investigator and crafted and signed a criminal Complaint — instead of allowing it to be investigated and prepared through proper channels of law enforcement — so that they could then prosecute [witness Franklin] Lee for committing perjury.”

Attempts to reach DiDonato and Marano on Thursday were not successful.

» READ MORE: A third man is exonerated in debunked 30-year-old murder case. Two others are suing the city.

Though Stokes alleged that homicide detectives engaged in a pattern of misconduct involving providing sex and drugs in exchange for statements, the DA’s Office has not conceded that.

However, the DA recently adjusted course on at least one other case in which similar allegations were raised involving the same detectives. The DA retracted its filing opposing review of a petition by Major Tillery to overturn his conviction for a 1976 murder, and agreed to provide additional discovery.

At least five other men remain incarcerated on cases fraught with “sex for lies” allegations.

Stokes and his family are hoping his case will be the start of unraveling that.

“It was a hard battle, but we knew justice was going to prevail. We didn’t give up,” Stokes’ sister Renee said on her way out of Philadelphia’s Stout Center for Criminal Justice. “Every other family, I encourage them to keep fighting. Don’t ever give up.”