One of the biggest makers of generic opioids in the United States has reached a tentative settlement of claims to avoid the first federal trial of drug makers, distributors and retail chains for their roles in the opioid epidemic.

Mallinckrodt Pharmaceuticals, a company investigators for the Drug Enforcement Administration once referred to as “the kingpin of the drug cartel,” announced Friday that it had agreed to pay $24 million to two Ohio counties. Under the agreement, the company would also donate $6 million worth of drugs, including addiction treatment medications, to the plaintiffs, Cuyahoga and Summit Counties.

The agreement came six weeks before the start of a trial that is intended to be a litmus test to help assess how much money the industry defendants in nearly 2,300 cases consolidated in federal court may eventually have to pay. The tentative agreement — which applies only to the two counties and does not resolve other legal claims against Mallinckrodt — is one result of a flurry of intensive bargaining in recent weeks among groups of defendants and plaintiffs in opioid cases nationwide .

Judge Dan Aaron Polster of the Federal District Court of Northern Ohio, who is overseeing the trial and all the federal cases, has prodded the parties to reach a global settlement that resolves all claims.