Four big drug companies have reached a last-minute, $260 million legal settlement over their role in the U.S. opioid addiction epidemic, averting the first federal trial that was scheduled to start Monday morning in Cleveland.

The settlement covers drug distributors AmerisourceBergen Corp, Cardinal Health Inc., McKesson Corp. and Israel-based drugmaker Teva Pharmaceutical Industries Ltd., and ends lawsuits by two Ohio counties.

Hunter Shklonik, an attorney for the counties, said Teva is paying $20 million in cash and will contribute $25 million worth of Suboxone, an opioid addiction treatment.

On Friday, talks collapsed aimed at reaching a broader $48-billion US settlement covering thousands of lawsuits filed by counties, towns and states from across the country over the crisis.

The trial was scheduled to pit two Ohio counties against the five companies that the local governments say helped fuel a nationwide crisis. Some 400,000 U.S. overdose deaths between 1997 and 2017 were linked to opioids, according to government data.

The judge overseeing Monday’s trial said he would work out a new trial date for the remaining defendant, pharmacy chain operator Walgreens Boots Alliance Inc.