Walmart this week proposed paying $3.1 billion to settle lawsuits by state and local governments that alleged its pharmacies improperly filled prescriptions for opioids, the Associated Press reports.

Under the settlement, if it is finalized, Walmart would pay most of the money over the next year. The company would have to comply with oversight measures, prevent fraudulent prescriptions and flag suspicious prescriptions. The plan needs to be approved by 43 states by December 15. Local governments can sign on to the settlement by March 31 of next year.

Earlier this month, CVS and Walgreens announced agreements in principle to pay about $5 billion each to settle opioid lawsuits. AP reports most pharmaceutical companies that produced the most opioids and the largest distribution companies have already reached settlements.

In a news release, New York Attorney General Letitia James said, “Pharmacies such as Walmart played an undeniable role in perpetuating opioids’ destruction, and my fellow attorneys general and I are holding them accountable.”