(Bloomberg) — Teva Pharmaceutical Industries Ltd. agreed to pay $85 million to settle an Oklahoma lawsuit claiming that illegal marketing of its opioid painkillers contributed to a public health crisis in the state.

The deal, announced Sunday, was reached just as the case was about to go to trial next week. The state had alleged Teva and co-defendant Johnson & Johnson persuaded doctors to boost prescriptions of the powerful medications to treat ailments for which they weren’t approved, causing overdose deaths and drug addiction.

The trial against remaining defendant J&J, which the state has called the “kingpin” of the U.S. opioid crisis, is expected to start on Tuesday.

The terms of the settlement may take up to two weeks to finalize, and the money will be used to “abate the opioid crisis in Oklahoma,” Attorney General Mike Hunter said in a statement.

Oklahoma had been seeking at least $10 billion in damages and penalties. The trial will be the first test of public-nuisance laws against opioid manufacturers and distributors. At least 42 states and more than 1,600 municipalities have sued companies in the industry, demanding billions of dollars in damages.

The last-minute deal in Oklahoma means some of the focus on opioid litigation shifts to Cleveland, where a federal judge has set two test trials for October to allow juries to consider public-nuisance claims over drug-marketing campaigns.

The accord comes about two months after Purdue Pharma LP agreed to pay $270 million to resolve Oklahoma’s claims over sales pitches for its opioid-based painkiller, OxyContin. Purdue sought a deal to ease mounting liabilities that have threatened to push the company into bankruptcy. The money was earmarked for research and treatment.

Oklahoma said J&J and Teva helped create a public-health crisis from opioid abuse that killed thousands of its residents. The state, in its lawsuit, accused the companies of overstating the painkillers’ benefits and understating their risks, which created a “devastating cycle of over-prescription’’ that was “built on addiction, dependence and a market saturated with misinformation regarding the benefits and safety of those drugs.”

Teva’s settlement doesn’t establish any wrongdoing on the part of the company.

The case is State of Oklahoma v. Purdue Pharma LP, CJ-2017-816, Cleveland County, Oklahoma, District Court (Norman).

Contact us at editors@time.com.

SPONSORED FINANCIAL CONTENT

Read More From TIME

EDIT POST