The Environmental Protection Agency has said it caused a large release of hazardous water from a mine above the town of Silverton, in Southwest Colorado. Which begs the question: What was the EPA doing with heavy equipment at a mine in the San Juan Mountains?

To understand that, you have to understand the history of mining in Colorado and the West.

For most of the West’s history, miners were basically allowed to run willy-nilly across the landscape, burrowing for gold, silver, or other valuable minerals. According to Ronald Cohen, an environmental engineer at the Colorado School of Mines, whenever you dig into a mountain, “at some point you are going to hit water.”

That water, when it runs through the rocks in a mine, hits a mineral called pyrite, or iron sulfide. It reacts with air and pyrite to form sulfuric acid and dissolved iron. That acid then continues through the mine, dissolving other heavy metals, like copper and lead. Eventually, you end up with water that’s got high levels of a lot of undesirable materials in it.

Which brings us back to the historic miners, putting holes in mountains across Colorado. For years, miners were not required to do anything with this water. In fact, most of them would dump it right into a creek, or put it in ponds with their tailings, where it became even more acidic.

“In the old days there was very little control and not much attention paid to control [of acidic water from mines],” said Cohen.

Fast forward to 2015, and the state of Colorado is dotted with abandoned mines -- 22,000, according to the state’s Division of Mining, Reclamation and Safety -- filling up with water that runs into its streams. And the mines outside of Silverton? They’re some of the worst. Here’s what a 2014 Durango Herald article had to say about the area above Silverton, which includes Gold King, the mine that released its toxic holdings August 5:

“Scientists say it’s the largest untreated mine drainage in the state, and problematic concentrations of zinc, copper, cadmium, iron, lead, manganese and aluminum are choking off the Upper Animas River’s ecosystem.”

Enter The Environmental Protection Agency

For years, the EPA has wanted to name areas around Silverton as a Superfund site. This brings funding for cleanups. The town, in turn, has resisted, fearing the label would be toxic to tourism. (pun intended.)

Recently, the town and the agency came to a sort of detente. The EPA wouldn’t list the site as Superfund, also called the National Priority List, as long as efforts were made to improve water quality near the mines. The EPA agreed to pay for those efforts, which recently got underway.

Somewhat ironically, the Gold King mine was not the object of the cleanup. The agency had planned to plug a mine [.pdf] just below it, the Red and Bonita Mine, with the goal of reducing acid runoff from that mine.

#NoFilter: the water really is this color in The Animas River in La Plata County after 1 m… http://t.co/8GNGL3JuQw pic.twitter.com/2pMhStvKkb — 9NEWS Denver (@9NEWS) August 7, 2015

Since mines are interconnected, however, and a plug in one can lead to more water flowing out the other, the agency planned to “remove the blockage and reconstruct the portal at the Gold King Mine in order to best observe possible changes in discharge caused by the installation of Red and Bonita Mine bulkhead.”

That project began July 2015. The Gold King Mine released its toxic load at 10:30 a.m. August 4, 2015.

Peter Butler, who serves as a co-coordinater of the Animas River Stakeholders Group, a roundtable, said the EPA knew there was water sitting at the mine.

“It was known that there was a pool of water back in the mine, and EPA had a plan to remove that water and treat it, you know, slowly. But things didn’t go quite the way they planned and there was a lot more water in there then they thought, and it just kind of burst out of the mine.”

Butler offered cautious support for the EPA’s work at the mine, in light of the spill.

“I think that they were doing a reasonable job, maybe there were some other steps that could have been taken, that could have prevented it. But I think it was a big surprise for almost everybody,” said Butler.

Even without agency mistakes, mines do experience blowouts from time to time -- although generally not on so large a scale, said Butler.

When asked if this would curb the appetite for additional mine cleanups, Butler said he thought it would have the opposite effect.

“I think it highlights the issues of water quality related to mines. And that getting a lot more publicity, a lot more people are going to be interested in doing stuff about mines.”

Read More: Animas River Spill A Stark Reminder Of Colorado's Mine Pollution Legacy