Deep divisions mark El Salvador: between left and right, rich and poor, gangs and police. Yet last week, when the country’s Congress voted to prohibit metallic mining, those divides seemed to melt away. From the left-wing Farabundo Martí National Liberation Front (FMLN) to the right-wing National Republican Alliance (ARENA), every party signed on to pass the bill unanimously, 69 to 0. San Salvador’s Archbishop José Luis Escobar Alas called the decision an "act of love." Johnny Wright Sol, a legislator from the ARENA party, explained that "water won out over gold."

Mindful of the well-being of all the country’s people, El Salvador made this bold, largely unprecedented move by building bridges across party lines, organizations, and regions. But El Salvador is no ordinary country. Water is in increasingly short supply: The country is about the size of New Jersey, and gets all its water from just a few rivers and aquifers. El Salvador’s mountains are full of silver and gold, but mining uses a lot of water and is often linked to pollution. Most Salvadorans think the risks aren’t worth it: Four out of every five wanted a ban on metallic mining.

But this public consensus didn’t arrive overnight. Just a few decades ago, Salvadorans were more enthusiastic about mining. In 1996, the Congress approved a law to promote foreign investment in mining; in the following decade the government issued more than 30 licenses.

But then villagers in Cabañas and Chalatenango started to see their wells dry up and became increasingly worried that the mines would poison their scarce water and that mining companies would take their land. Soon after, local communities, faith leaders, and environmentalists created a National Front Against Metallic Mining, and the national conference of bishops spoke out in support of its efforts.

Amid social struggle and violence against human rights defenders, momentum was so strong that in 2008, President Elias Antonio Saca decided to impose an informal moratorium on metallic mining. But the mining companies wouldn’t accept it. One Canadian firm, Pacific Rim, tried to use international investment treaties to sue for damages, demanding that the government compensate the company for lost profits. For over seven years, three Salvadoran presidents fought Pacific Rim (which later became OceanaGold) in the international arbitration court. The company demanded almost $300 million, but in October 2016 the court ruled against them, noting that the company never met the conditions to get a mining license in the first place. It was a major victory for national sovereignty.

Meanwhile, as the government was fighting PacificRim/OceanaGold in the courts, the evidence against metallic mining was mounting. In 2010, a government-commissioned impact assessment concluded that metallic mining posed major risks to the country’s environment and water supplies.

Against this backdrop (and with Ford Foundation support), local governments and civil society have been working not only to oppose megaprojects that would harm communities but also to promote local models for economic development that seek to affirm communities’ own visions and priorities. Together, they seek to advance development in ways that make sense at the regional or territorial level, take communities' preferences and concerns into account, and ensure responsible management of natural resources. With communities and local authorities acutely aware of the health and environmental costs, large-scale mining has not figured into local plans. Uncertain of the future of the 2008 mining moratorium, the Territorial Association of Mayors (and its network of supporting organizations) have moved ahead with participatory territorial development planning, and sought to leverage municipal resources, national funds, and World Bank investments to do so.

Thanks to all this action, when the archbishop of the Catholic Church and the rector of El Salvador’s most prestigious university presented a draft law to prohibit mining last month, the country was ready to listen and act. Congressional legislators held hearings and visited regions throughout the country, and found resounding support for prohibition. When OceanaGold orchestrated a public relations campaign touting the benefits of metallic mining, opponents responded by asking the governor of Nueva Vizcaya, in the Philippines, to share his province’s negative experiences with the company.

Here at the Ford Foundation, we have been inspired by this process. It is wonderful to see Salvadorans put aside their differences to protect human health and the environment—and to see governments from both major political parties listen to poor rural villagers, scientists, and people of faith, and put the national interest above corporate greed. Though there remains a need for government to listen the voices of more of its citizens, El Salvador’s ban on metallic mining is a triumph, and one others can learn from. That includes municipal governments and civil society, who can now focus on the enormous challenge of improving conditions across El Salvador.