Purdue Pharma has reached a deal for up to $12 billion to settle the thousands of lawsuits it faced for the role its notorious painkiller OxyContin played in fueling the opioid epidemic.

Helmed by the billionaire Sackler family, Purdue reached the agreement Wednesday with 23 state governments and 2,000 cities and counties that were trying to hold the company accountable for what many saw as a case of putting greed before people’s lives.

Under the settlement, Purdue will file for Chapter 11 bankruptcy and dissolve, while the Sackler family will relinquish control of the company.

The Sackler family, ranked by Forbes in 2016 as the 19th richest in America, will pay about $3 billion in cash over seven years as part of the settlement, which does not include any acknowledgment of wrongdoing.

Purdue also will donate drugs for addiction treatment and overdose reversal.

A number of states, including New York, New Jersey and Connecticut, have not agreed to the settlement and have vowed to continue court fights against Purdue Pharma.

“While our country continues to recover from the carnage left by the Sacklers’ greed, this family is now attempting to evade responsibility and lowball the millions of victims of the opioid crisis,” New York Attorney General Letitia James said.

Pennsylvania Attorney General Josh Shapiro added, “This apparent settlement is a slap in the face to everyone who has had to bury a loved one due to this family’s destruction and greed.”

Wednesday’s settlement comes four years after former Purdue chairman Richard Sackler denied his family helped fuel the epidemic.

The lawsuits allege the company aggressively marketed the painkiller despite knowing it was addictive.

It’s believed the deal, negotiated by five lawyers for the thousands of plaintiffs, would end most of the cases against the company.

Under terms of the deal, Purdue will dissolve and form into a new company that will continue to sell OxyContin with the proceeds going to a public-benefit corporation that will pay plaintiffs, The New York Times reported.

The opioid crisis has claimed the lives of half a million people in the US since 1999, according to the Centers for Disease Control and Prevention.

An Oklahoma judge in August ordered Johnson & Johnson to pay $572 million in damages for its role in fueling that state’s opioid epidemic.

The landmark ruling was in response to a $17 billion lawsuit which alleged the drugmaker overstated how effective its pills were in treating chronic pain while minimizing the risk of addiction, the state claimed.

With Post Wires