The law also bans the use of cyanide and mercury for mining.

Legislators across the political spectrum supported the measure, which does not apply to quarrying or the mining of coal, salt and other non-metallic resources.

Supporters said the ban was essential to protect water reservoirs and reduce social tensions.

“Mining is not an appropriate way to reduce poverty and inequality in this country,” Ivan Morales, country director for the charity Oxfam in El Salvador said in a statement. “It would only exacerbate the social conflict and level of water contamination we already have.”

The law also bans the use of cyanide and mercury for mining.

According to the United Nations, El Salvador is one of the most densely populated countries and the second-most environmentally degraded in America, after Haiti, which makes it especially sensitive to the potential impact of large mining projects.

In October, the government won an international arbitration case filed by Pac Rim over a rejected licence to build a gold mine in the country’s north. The panel rejected the company’s claim for compensation.