A protester at the legislative assembly in San Salvador holds a banner reading ‘No to mining, yes to life’.
Photograph: Marvin Recinos/AFP/Getty Images

El Salvador has made history after becoming the first country in the world to ban metal mining.

Lawmakers in the water-parched country passed the ban in a unanimous vote on Wednesday, declaring El Salvador a mining-free territory.

The decision followed a long and bitter struggle to protect the Central American country’s diminishing water sources from polluting mining projects.

Campaigners holding banners with the now famous “No to mining, yes to life” slogan celebrated inside and outside the legislative assembly in the capital, San Salvador.

“The vote is a victory for communities who, for more than a decade, have relentlessly organised to keep mining companies out of their territories. The prohibition ensures the long-term ecological viability of a country already considered one of the most environmentally vulnerable in the world,” said Pedro Cabezas, from International Allies Against Mining in El Salvador.

Wednesday’s vote, which was expected by both sides to be much closer, builds on a rising tide of popular opposition to environmentally destructive projects across Latin America, where partial bans have been implemented in Costa Rica, Argentina and Colombia.

El Salvador is the most densely populated country in Latin America and, while rainfall is plentiful, holding on to the water is a major issue because of unsustainable farming practices and inadequate industrial controls that have led to widespread soil erosion and the almost total destruction of its forests.

Cyanide and iron have been found in the San Sebastián River, in El Salvador’s La Unión state. Photograph: Courtesy of Stopmining

Momentum around a ban had been gathering pace since October last year, when an international tribunal threw out a claim by a multinational mining company to force the Salvadoran government to pay out millions in compensation for refusing to let it dig for gold. The company had backed the campaign opposing the ban, promoting the benefits of responsible mining.

But the claim by OceanaGold that it was unfairly refused permission to start digging at its El Dorado mine, in the Cabañas region, was dismissed as without merit and the firm was ordered to pay El Salvador $8m towards legal costs.

The ruling marked the end of a long-running, bitter dispute that had been blamed for delaying concrete measures to tackle worsening pollution and water shortages.

National polls have consistently reported that the vast majority of Salvadorans wanted a ban and earlier this month thousands of people took to the streets in support of the bill, which was backed by the Catholic Church, academics and civil society groups.

Jen Moore, the Latin America programme coordinator at MiningWatch Canada, said the victory would encourage other countries to stand up against the muscle of mining giants.

“The Salvadoran people and leaders made huge efforts to weigh the short-term benefits with the long-term risks to their water, environment and social wellbeing … and despite the efforts of a company to try to blackmail the country, they showed it is possible to win against significant odds.”

In 2009, the newly elected left-wing FMLN government initiated a de facto moratorium on metallic mining amid growing anger in threatened rural communities.

In the Cabañas region, where the El Dorado mine is situated, resistance mounted after community station Radio Victoria launched a campaign opposing mining in 2008.

Cristina Starr, from Radio Victoria, said: “Today water won over gold. This historic victory is down to the clarity and determination of the Salvadoran people fighting for life over the economic interests of a few.”

The country’s total ban on abortion has seen women jailed over miscarriages and dying after unsafe terminations. But amid growing protests, politicians may bow to pressure to overturn El Salvador’s anti-abortion laws