The pharmaceutical giant Johnson & Johnson has settled a major opioid lawsuit in a significant climbdown weeks before the opening of a multibillion-dollar trial over corporate responsibility for the US opioid epidemic, which has claimed 400,000 lives over the past two decades.

Johnson & Johnson agreed to pay two Ohio counties a total of $20m to avoid the first in a series of federal trials aimed at establishing to what extent opioid painkiller manufacturers, distributors and pharmacy chains are culpable for the worst drug epidemic in American history.

Although the settlement with Cuyahoga and Summit counties, which include Cleveland and Akron, Ohio, was relatively small, it potentially opens the door to payouts totalling billions of dollars to more than 2,000 other counties, municipalities and Native American tribes suing over the damage caused by the crisis.

The Ohio test case, which opens on 21 October, is one of a series of trials intended to establish if the drug industry is liable for the epidemic and, if so, how much it should pay. A second trial is scheduled for West Virginia in January. The decisions in these and other test cases would then be used to shape a broad settlement covering many of the federal lawsuits across the US.

Until now, Johnson & Johnson has steadfastly refused to settle similar lawsuits and has strongly denied any responsibility for the epidemic, saying it was doing no more than manufacturing a legal drug. But in August it lost a landmark case in Oklahoma, where a judge found the company was instrumental in causing addiction and death with a “false and dangerous” sales campaign that helped drive the crisis.

The state of Oklahoma sued the company, saying it ran a “cunning, cynical and deceitful scheme” to mass market opioid painkillers with false claims that there was little risk of addiction from the drugs. The judge ordered Johnson & Johnson to pay $572m in the first year of a longer term settlement.

Johnson & Johnson made no admission of liability in the Ohio settlement and said it reached agreement in order to direct money and effort toward addressing the opioid crisis. But Carl Tobias, a law professor at the University of Richmond, said the Oklahoma loss will have weighed heavily on the company going into the Ohio trial.

“Johnson & Johnson has a reputation for litigating to the bitter end but Oklahoma may have been a wake-up call because they thought they were going to win. Now they may be rethinking whether they should litigate every case because it looks like there is exposure to liability,” he said.

It remains to be seen whether the company will settle with hundreds of other litigants which could be expected to total hundreds of millions if not billions of dollars. But most of the drug-makers have folded as the trial draws nearer, apparently wary that the courts could order even larger payouts.

Johnson & Johnson’s retreat came days after one of the largest opioid manufacturers, Mallinckrodt, reached a $30m deal with the two Ohio counties. Two other companies, Endo and Allergan, agreed to settlements earlier. That leaves just one manufacturer, Teva, still fighting the case alongside the pharmacy chain Walgreens and drug distributors, which are some of the largest corporations in the US even if their names are not widely known.

That may result in this month’s trial giving an unwelcome focus on the part played by distributors such as Cardinal Health and McKesson, which poured millions of opioid pills into small communities.

Tobias said that will add to the pressure on them to settle before the trial.

“They should be feeling the pressure because they’re the deepest pockets left. They may settle to avoid a substantial settlement. They may want to avoid a huge verdict at the beginning,” he said.

Separately, Purdue Pharma, the drug-maker that kickstarted the epidemic with its powerful opioid OxyContin, has reached a tentative deal potentially worth several billion dollars with some states in which it uses bankruptcy to remake the company as a trust and surrender future profits toward addiction treatment and prevention.