Target has reached a $7.4 million lawsuit with the state of California over allegations that the company improperly dumped hazardous materials between 2012 and 2016.

California Attorney General Havier Becerra said Wednesday that the mega-chain would have to pay $3.2 million in fines, and an additional $3 million will go toward compliance inspections and audits of its trash facilities. Target will also fund environmental projects as part of the settlement.

The state and 24 local governments alleged that between 2012 and 2016, Target mishandled hazardous waste ranging from batteries and aerosol cans to fluorescent light bulbs.

“Target’s ongoing and improper disposal of hazardous waste and contaminants harmed the public and the environment,” Becerra said in a statement.

The district attorney’s office alleged that Target “unlawfully disposed” of 2,038 hazardous waste items, 175 items containing confidential medical information and 94 items deemed medical waste between 2012 and 2014 alone.

According to Becerra’s statement, Target was accused of violating state laws and “injunctive terms” from a previous lawsuit in 2011 because of the findings.

“We are confident that with these strong injunctive terms and penalties, Target will implement meaningful changes to prevent this from ever happening again,” Becerra said. “However, the wise move for all companies is to abide by the law and employ proactive training and processes to help ensure that hazardous waste violations are avoided in the first place.”

"We’ve made significant progress in the way we handle hazardous waste following our 2011 settlement with the state of California. We have enhanced team member training, store operations and auditing processes and we continue work to improve our operations to best manage disposing of items like batteries, hairspray and laundry detergent that require additional, special care under California laws," Target said in a statement to Fox News.

This is the second settlement of allegations that Target violated hazardous waste rules. Under the 2011 settlement, Target agreed to pay $22.5 million in penalties, court fees and environmental funding.

The Associated Press contributed to this report.