Three of the largest U.S. pharmacy chains — CVS, Walgreens and Walmart — are reported to have tentatively agreed to pay more than $13 billion to settle more than 3,000 state and local lawsuits involving the dispensing of opioid painkillers.

Sources close to the negotiations report CVS will pay $5 billion over 10 years, Walgreens will pay $5.7 billion over 15 years and Walmart will pay $3.1 billion, mostly up front. The sources remained anonymous as they were not authorized to speak publicly about the agreement.

In a statement released Wednesday, CVS Health said it has agreed it will pay approximately $5 billion — with $4.9 billion to states and political subdivisions and approximately $130 million to Native American tribes — over the next 10 years beginning in 2023.

In the statement, CVS Health Chief Policy Officer and General Counsel Thomas Moriarty said, “We are committed to working with states, municipalities and tribes, and will continue our own important initiatives to help reduce the illegitimate use of prescription opioids.”

The CVS statement included a list of initiatives it has undertaken to fight opioid abuse.

In the lawsuits, governments said pharmacies were filling prescriptions they should have flagged as inappropriate.

If the settlement is finalized, it would be the first nationwide deal with retail pharmacy companies and follows nationwide opioid settlements with drugmakers and distributors totaling more than $33 billion.

Opioids are natural, synthetic, or semi-synthetic chemicals used to reduce the intensity of pain signals and feelings of pain. The class of drugs includes the illegal drug heroin, synthetic opioids such as fentanyl, and pain medications available legally by prescription, such as oxycodone, hydrocodone, codeine, morphine, and many others.

The U.S. Centers for Disease Control and Prevention reports that from 1999 to 2020, more than 564,000 people in the U.S. died from an overdose involving an opioid, including prescription and illicit opioids. They report 187 people in the U.S. continue to die from an opioid overdose every day.

The Associated Press and Reuters provided some information for this report.