SAN SALVADOR, El Salvador (CNS) — At the urging of Catholic leaders, El Salvador has passed a law banning metal mining nationwide, making the small Central American country the first in the world to outlaw the industry.

The new law, approved overwhelmingly by El Salvador’s congress March 29, orders the Economy Ministry to close existing mines while prohibiting the government from issuing new mining licenses. It gives small-scale and artisanal miners a two-year period to phase out production.

Mining had become highly contentious in the country of 6.3 million, as environmental groups protested the effects on water sources and soil contamination. Anti-mining groups have claimed that at least four people had died in mining conflicts.

“Mission accomplished,” said Congressman Guillermo Mata of the ruling party, the Farabundo Marti National Liberation Front, on his Twitter account. “As a political party, we were the drivers, but the hard work was done by the social movements, the NGOs and the church.”

Previous initiatives to ban the practice were defeated by conservative factions of congress. But momentum shifted last year, when the government won a $300 million lawsuit brought against it by Pac Rim Cayman, a unit of Canadian-Australian mining giant Oceana Gold, which has operations in New Zealand and the Philippines. The government had denied permits for a gold mining project in northern El Salvador that the company was trying to establish. It sued for unrealized profits.

The legal win prompted a diverse set of organizations to push for a new mining law. The push was led by Catholic bishops, who in February called on congress to pass an outright ban. Demonstrations and a petition signed by 30,000 residents furthered the push for a ban.

“We have to defend the rights of all people; as a church, we will always defend the right to life,” Archbishop Jose Luis Escobar Alas of San Salvador said at the time.

Although it is the first nationwide metal mining ban, other countries already ban some mining processes, like the use of cyanide to extract gold.

Anti-mining groups praised the Salvadoran vote.

“It is amazing what this small country has achieved against tremendous odds,” said Manuel Perez-Rocha of the Institute for Policy Studies in Washington. The institute, part of the International Allies coalition with the National Roundtable Against Metallic Mining in El Salvador, sees the law as “an inspiration for countries throughout the region,” he said.