The nation’s three biggest drug distributors and a major drugmaker reached an 11th-hour, $260 million settlement over the toll of the opioids in two Ohio counties, averting what would have been the first federal trial over the crisis.

The settlement was announced just hours before the trial was scheduled to start, with a jury selected last week.

The trial involved only two counties — Cleveland’s Cuyahoga County and Akron’s Summit County — but was seen as an important test case that could gauge the strength of the opposing sides’ arguments and prod them toward a nationwide settlement.

Across the country, the drug industry is facing more than 2,600 lawsuits brought by state and local governments seeking to hold it accountable for the crisis that has been linked to more than 400,000 deaths in the U.S. over the past two decades. A federal judge in Ohio has been pushing the parties toward a settlement of all the lawsuits for nearly two years.

The agreement announced Monday calls for the distributors AmerisourceBergen, Cardinal Health and McKesson to pay a combined $215 million, said Hunter Shkolnik, a lawyer for Cuyahoga County.

Israeli-based drugmaker Teva would contribute $20 million in cash and $25 million worth of Suboxone, a drug used to treat opioid addiction.

“People can’t lose sight of the fact that the counties got a very good deal for themselves, but we also set an important national benchmark for the others,” Shkolnik said.

The deal contains no admission of wrongdoing by the defendants, said Joe Rice, a lead plaintiffs’ lawyer.

But it could turn up the pressure on all sides to work out a nationwide settlement, because every partial settlement reached reduces the amount of money the companies have available to pay other plaintiffs.

After the new settlements and previous ones with other drugmakers, the only defendant left in the trial that had been scheduled for Monday is the pharmacy chain Walgreens. The new plan is for Walgreens and other pharmacies to go to trial within six months.

Monday’s settlement removes the risks and uncertainties involved in a trial for both sides: The counties immediately lock in money they can use to deal with the crisis, and the drug companies avoid a possible finding of wrongdoing and a huge jury verdict.

In a statement, the attorneys general from North Carolina, Pennsylvania, Tennessee and Texas, which are leading those talks, said that effort will continue — and that the Ohio settlement helps.

“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,” they said.