CNN  — 

Hours before the first federal trial in the opioid epidemic was set to begin, four pharmaceutical companies reached a settlement totaling $260 million.

The four companies – McKesson Corp., Cardinal Health Inc., AmerisourceBergen Corp. and Teva Pharmaceutical Industries Ltd. – reached a settlement Monday morning with the two plaintiffs, Summit and Cuyahoga counties in Ohio.

McKesson Corp., Cardinal Health Inc. and AmerisourceBergen Corp. will pay out a combined $215 million immediately, and Teva Pharmaceutical will pay $20 million, officials said at a press conference Monday.

Teva will also be donating $25 million worth of Suboxone, according a source familiar with the settlement.

The settlement was struck between midnight and 1 a.m. Monday, and the case was dismissed with prejudice, US District Court Judge Dan Polster said.

The defendants were supposed to appear in a Cleveland court Monday in the first federal multidistrict litigation (MDL) trial involving the opioid epidemic. Thousands more plaintiffs’ cases are awaiting trial.

MDL is similar to class-action lawsuits in the sense that both consolidate plaintiffs’ pretrial proceedings for the sake of efficiency. But unlike with class-action lawsuits, each plaintiff in an MDL case can get a different verdict or award.

The plaintiffs in this MDL case – Summit and Cuyahoga counties – were the first among more than 2,700 plaintiff communities to head to trial.

Three of the defendants – AmerisourceBergen, Cardinal Health and McKesson – issued a joint statement saying the settlement does not mean they are at fault.

“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 joint statement said.

“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. The distributors remain deeply concerned about the impact the opioid epidemic is having on families and communities across the nation – and are committed to being part of the solution.”

The money will go towards treatment

Attorneys general from four states – North Carolina, Tennessee, Pennsylvania and Texas – lauded Monday’s settlement as “an important step” in combating the opioid epidemic.

“People in every corner of the country have been hurt by this crisis, and it is critical that settlement funds be distributed fairly across states, cities, and counties and used wisely to combat the crisis,” the attorneys general said in a joint statement.

“The global resolution we are working to finalize will accomplish those goals while also ensuring that these companies change their business practices to prevent a public health crisis like this from ever happening again.”

Both Summit County and Cuyahoga County have announced plans for how settlement awards would be allocated.

“This is a national emergency right now, and all counties, all municipalities, all villagers need help right now to combat this crisis,” Cuyahoga County Prosecutor Michael O’Malley said.

“We are looking at using this money for treatment, and getting people into programs and helping first responders as they deal with this crisis.”

Two other defendants were also involved in this case – a smaller pharmaceutical company, Henry Schein Medical, and the pharmacy chain Walgreens.

Walgreens was not part of the settlement. Judge Polster said claims against the company have been cut off and moved to a different track, with a schedule to follow.

Walgreens released a statement Monday saying it is “completely unlike the wholesalers involved in the national opioid litigation.”

“Before 2014, Walgreens delivered opioid medications – among many other types of medications – only to our own pharmacies, staffed by our own pharmacy professionals,’ company spokesman Phil Caruso said.

Henry Schein Medical will be making a donation of $1 million to establish an educational foundation with Summit County and will pay $250,000 of the county’s expenses, the company said in a written statement.

Henry Schein said the plaintiffs have “agreed to dismiss the Company.”

More work needs to be done, attorneys say

The sudden settlement Monday followed marathon negotiations that went nowhere last week.

The talks lasted more than 10 hours and involved the CEOs of the four major companies; attorneys general from Tennessee, North Carolina, Pennsylvania and Texas’ and lawyers representing over 2,000 state, local and Native American tribal governments.

Attorneys for the plaintiffs welcomed the settlement, but said more work needs to be done in fighting the opioid epidemic.

“The proposed settlement will make significant progress to abate the epidemic by providing resources for and applying funds directly to necessary opioid-recovery programs,” said a joint statement from Paul J. Hanly Jr., Paul T. Farrell Jr. and Joe Rice.

“Throughout this process, Summit and Cuyahoga Counties have tirelessly investigated, litigated, and prepared for the bellwether trial that would have begun today if not for this agreement. In doing so, the communities revealed facts about the roles of the opioid industry that created and fueled the opioid epidemic.”

Summit County Executive Ilene Shapiro said the settlement is just one step in a long road ahead.

“The long-term impacts on our children that have been byproducts of this health crisis won’t end just because a settlement has been done,” the county official said. But for now, she added, “we will at least be able … to move on with something to help our folks in the shorter term.”

CNN’s Evan Simko-Benarski, Brian Vitagliano, Ben Tinker, Amir Vera and Kate Trafecante contributed to this report.