Corporations that have been blamed for the opioid epidemic in the US just agreed to pay out million to settle a key case before it went to trial.

On Monday, drug distributors AmerisourceBergen, McKesson, and Cardinal Health and drugmaker Teva agreed to settlements to avoid going to trial, the The Wall Street Journal reported. The Washington Post and The New York Times said the settlement was worth $260 million.

Of that, the three drug distributors are contributing a combined $215 million, the companies said in a joint statement.

“While the companies strongly dispute the allegations made by the two counties, they believe settling the bellwether trial is an important stepping stone to achieving a global resolution and delivering meaningful relief,” the three drug distributors said in the statement. “The companies expect settlement funds to be used in support of initiatives to combat the opioid epidemic, including treatment, rehabilitation, mental health and other important efforts.”

Teva said in a release that it's agreed to pay out $20 million over the course of three years, as well as contribute $25 million of a critical opioid treatment over the same time period.

The deal doesn't settle thousands of other lawsuits against drugmakers and distributors. Attorneys general had been pushing for the drugmakers and distributors to agree to settlements worth tens of billions nationally.

Teva said in its release that there is an agreement in principle with attorneys general from four states and other defendants for a "global settlement framework." Under it, Teva would donate $23 billion worth of opioid addiction treatment - buprenorphine naloxone - over the next 10 years.

Teva's stock rose 12.1% after announcing the settlement framework, while the shares of the three drug distributors all declined on Monday. Eric Coldwell, an analyst at Baird, said the stocks are likely falling because investors are worried about how much the distributors may be required to pay to resolve all of the suits.

"We are not surprised to see distributor shares giving back some of last week's gains as uncertainty persists in this extremely complex litigation," he wrote in a note to investors on Monday.

Retail pharmacy Walgreens had not reached a settlement related to the lawsuit, the Wall Street Journal said. The district judge in the case said Monday that the trial against the pharmacy giant has been postponed, The Journal reported.

"The allegations against Walgreens are very different, and Walgreens is completely unlike the wholesalers involved in the national opioid litigation," a Walgreens spokesman said in a statement. "We never manufactured, marketed or wholesaled prescription opioid medications. We never prescribed any opioid medication, and never sold opioid medications to pain clinics, internet pharmacies or the 'pill mills' that fueled the national opioid crisis."

Between 1999 and 2017, more than 218,000 people in the US died from overdoses related to prescription opioids, according to the Centers for Disease Control and Prevention. The opioid-addiction epidemic has led to changes in how the common painkillers are prescribed and used in hospitals and an increased emphasis on addiction treatments.

Over the years, thousands of lawsuits have been filed pinning blame for the opioid epidemic on different parts of the pharmaceutical industry, from those making the drugs to those distributing and dispensing them. The trial set to start on Monday would have been the first federal trial to deal with who is responsible for the epidemic.

Read more: The opioid-addiction epidemic costs $200 billion a year. These 5 digital health startups are trying to expand access to treatments and halt the crisis.

Cardinal Health, Amerisource Bergen, and McKesson are the biggest drug distributors in the US. They're in charge of shipping drugs around the US to pharmacies and hospitals. Distributors, which are paid based on the amount of drugs they distribute, are under fire for not monitoring the amount of opioids going out into the market.

Already, Johnson & Johnson in August was ordered by a judge in Oklahoma to pay out $572 million to the state for its part in fueling the opioid crisis, a decision the company plans to appeal. J&J makes prescription opioids including a fentanyl patch. Teva makes generic versions of drugs like oxycodone. The manufacturers are accused of misleading marketing that promoted the drugs' use as pain treatments.

This isn't the first time drug companies have paid out settlements in connection to opioid lawsuits. In September, OxyContin-makers Purdue Pharma tentatively settled thousands of cases against the company and its owners the Sackler family. The New York Times reported that under the deal the Sacklers would pay $3 billion in settlements over seven years.

Days later, the company filed for bankruptcy.