OxyContin maker Purdue Pharma hatched a secret plan to get into the business of selling drugs to treat the opioid addiction that its own products fueled, newly unsealed court filings allege.

The explosive claim comes in a lawsuit filed by the state of Massachusetts, which accuses Purdue owners the Sackler family and company honchos of creating and then profiting from opioid epidemic “through a web of illegal deceit.”

Starting in 2014, the company began discussing a plan called “Project Tango” to expand into opioid addiction treatments, the suit alleges.

In internal documents about the scheme, staff acknowledged “what Purdue publicly denied for decades: that addictive opioids and opioid addiction are ‘naturally linked,’” the suit charges.

An illustration of an “end-to-end” business model shows a funnel with “pain treatment” at the top and “opioid addiction treatment” at the bottom, while a graph shows the opioid abuse “market” had grown by a billion dollars between 2009 and 2014.

The plan never eventuated, but in 2016, the Sacklers met to discuss a “revised” version of Tango — selling the overdose antidote Narcan, which they identified as a “complementary” product to Purdue opioids, according to the suit.

The following year, future Purdue CEO Craig Landau proposed capitalizing on the crisis in a different way — while other companies were abandoning opioids amid the addiction epidemic, he said Purdue should double down and become an even more dominant opioid seller, the suit alleges.

He also noted in his presentation that the company’s board — the majority of which is controlled by the Sacklers — operated as its “de facto” CEO, even as the company denied that the family members held any “management positions” in the business.

Indeed, the suit alleges the Sacklers voted to pay their family more than $4 billion from Purdue’s opioid profits between 2007 and 2018.

The suit also alleges that the company collected, but sat on, details of suspected “problem prescribers” — with staffers reporting the doctors to the board by name, “along with the exact number of prescriptions and dollars of revenue each provided to Purdue.”

Meanwhile, the company hired consulting firm McKinsey to study how it could get doctors to prescribe more Oxy and to keep patients on opioids longer, the document charges.

The consultants “urged” the Sacklers to demand sales reps increase their visits to doctors — especially to the “most prolific opioid prescribers” — while also helping advise on how to “counter the emotional messages from mothers with teenagers that overdosed in [sic] OxyContin,” the suit claims.

In a lengthy response, Purdue said the suit was part of “a continuing effort” to blame the company “for the entire opioid crisis, and try the case in the court of public opinion rather than the justice system.”

Among the Massachusetts Attorney General’s most “egregious mischaracterizations,” the company writes, was “casting in a negative light Purdue’s due diligence on a potential acquisition of a drug for the treatment of addiction that was already on the market; even though the company never actually made the acquisition.”