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.