DENVER – Colorado could receive at least $300 million in a settlement with several distributors and a manufacturer of opioids under a tentative agreement contingent on local governments and states agreeing to the deal.

Colorado Attorney General Phil Weiser announced Colorado’s possible portion of the settlement, which will be worth up to $26 billion across the country, Wednesday morning.

The full tally for distributors Cardinal Health, McKesson and AmerisourceBergen and manufacturer Johnson & Johnson would be paid out over 18 years , with those three distributors footing up to $21 billion of the costs over that time period. Johnson & Johnson will pay up to $5 billion over nine years, including $3.7 billion in the first three years, Weiser said.

States will have 30 days to agree to the deal, then would have to get local governments to sign on to participate. If a “critical mass” of states and local governments decide to participate in the settlement, they would receive maximum payments based on a formula accounting for the number of overdose deaths in a state, the number of people with substance use disorder and the number of opioids prescribed.

Weiser said Colorado supports the deal and that his office has already started working with local governments to develop a framework to distribute the money it receives.

Should the state receive $300 million or more, combined with previous settlements with Purdue Pharma and other opioid manufacturers and distributors , the state would have around $400 million to put toward opioid use and recovery programs, treating substance use disorder, education and more.

Colorado says the money would “support recovery, treatment, and education and prevention programs, as well as appropriate harm reduction efforts and addressing the impact of the epidemic in the criminal justice system.”

According to Colorado data , more than 7,600 Coloradans have died from accidental opioid overdoses over the past 20 years, and around 1,500 died from an opioid overdose last year.

Weiser said he felt like Colorado and its local governments could establish a “national model” as to how to facilitate the programs stemming from the settlement money as it comes in over the next several years. He called the settlement a “once-in-a-generation opportunity” to address the opioid and substance abuse crises.

“We now have critical work to do to ensure that these funds—working with our local government partners—are used effectively to abate this epidemic,” Weiser said.

Colorado was one of several states involved in lawsuits against the companies and argued the drug distributors failed to refuse to ship opioids to pharmacies with suspicious orders and that Johnson & Johnson misled patients and doctors about how addictive opioids were.

As terms of the agreement, Johnson & Johnson will have to stop manufacturing and selling opioids for 10 years, stop lobbying activities surrounding opioids, and share its clinic trial data. The three distribution companies will have to establish a central data aggregation clearinghouse, improve their systems to detect suspicious orders, and prohibit the shipping of suspicious orders, among other things.

According to preliminary CDC data , a record number of Americans died of drug overdoses last year, and deadly overdoses were up 30% over the year prior.