HARTFORD, Conn. (WTNH) — CVS and Walgreens agreed to deliver $10.7 billion to fight the opioid epidemic across the country, with Connecticut set to receive about $127 million, Attorney General William Tong announced Monday.

CVS will pay $5 billion, and Walgreens will pay $5.7 billion nationwide, Tong said. Adding the recently announced settlement with Walmart, the three major chain pharmacies will pay nearly $14 billion, with Connecticut set to receive about $162 million.

“One by one, we are holding every player in the addiction industry accountable and forcing them to turn over billions of dollars for treatment and prevention nationwide,” Tong said. “CVS and Walgreens flooded our cities and towns with bottles upon bottles of pills with callous disregard for the suffering their actions caused.”

CVS, Walgreens, and Walmart agreed to court-ordered injunctive relief that requires the pharmacies to monitor, report, and share data about suspicious activity related to opioid prescriptions.

The terms of the agreement will now go to the states for their review. Each state will have until the end of 2022 to join, after which the CVS, Walgreens, and Walmart agreements will go to local governments around the country for sign-on during the first quarter of 2023. Connecticut intends to join the agreements, Tong said.

Nearly all settlement funds must be used to remediate the opioid crisis, including prevention, harm reduction, treatment, and recovery services. Tong said the payments are structured to ensure critical support in the immediate future and sustained resources over time.

According to the attorney general’s office, most of Walmart’s amount will be paid during the first year; CVS’s payments will be spread over 10 years; Walgreens’ payments will be spread over 15 years. If there is sufficient sign-on, payments should begin during the second half of 2023.

The latest settlement brings the total amount recovered from investigations and litigation nationwide against the pharmaceutical industry to more than $50 billion. Connecticut will have recovered $600 million to fight the opioid epidemic.