(Reuters) - New Mexico sued the U.S. Environmental Protection Agency, an agency contractor and two mining companies on Monday over the 2015 breach of an abandoned Colorado gold mine that spilled some 3 million gallons of toxic wastewater into three states.

Yellow mine waste water is seen at the entrance to the Gold King Mine in San Juan County, Colorado, in this picture released by the Environmental Protection Agency (EPA) taken August 5, 2015. REUTERS/EPA/Handout/File Photo

The Gold King Mine rupture, which was accidentally triggered by an EPA inspection team called there to inspect seepage, unleashed a torrent of yellow sludge that contained high concentrations of heavy metals such as arsenic, mercury and lead. New Mexico, Colorado and Utah were affected.

New Mexico Attorney General Hector Balderas said in a statement issued with the 51-page lawsuit filed in U.S. District Court that the discharge caused widespread environmental damage and substantial economic harm to residents, farmers and local businesses for which the state has not been compensated.

“The release of hazardous substances into waters that are the lifeblood of our economy and culture in New Mexico has had a devastating impact on our historical rural, agricultural and tribal communities,” Balderas said.

The lawsuit, which names the EPA, its contractor Environmental Restoration, the Kinross Gold Corp and Sunnyside Gold Corp, seeks reimbursement for cleanup costs as well as damages and a court order requiring that the defendants take steps to prevent future such spills.

A spokesman for the EPA said he could not comment on pending litigation but that the agency had taken responsibility for the Aug. 5, 2015 spill and had already paid $1.3 million to reimburse New Mexico, along with other funds that had been allocated for cleanup and monitoring Representatives for Missouri-based Environmental Restoration and the two mining companies, could not be reached for comment on Monday.

Colorado and New Mexico both declared state of emergencies over the spill from the century-old Gold King Mine near the town of Silverton, which fouled the San Juan River and its northern tributary, the Animas River.

Residents living downstream from the mine were advised to avoid drinking or bathing in water drawn from wells in the vicinity. Two Colorado municipalities, including the city of Durango, and the New Mexico towns of Aztec and Farmington temporarily shut off their river intakes.

Colorado has more than 4,000 abandoned mines, about 1,100 of them around Silverton, according to American Rivers, which calls those sites “ticking time bombs.”

Colorado and Utah have also said they were considering lawsuits.