El Dorado Guide Clash of Lords 2
Millions in investments lost
The Canadian company had spent years carrying out research in El Salvador's northern Cabana department, with investments amounting to $77 million, according to its own statements.
But when Pacific Rim wanted to begin digging for gold, the government in the capital San Salvador wouldn't give way. Then-President Antonio Saca refused to give the Canadians the necessary permits, citing concerns for the country's drinking water reserves.
In 2009, Pacific Rim responded by filing a complaint with the World Bank's International Center for Settlement of Investment Disputes (ICSID). The firm also sued El Salvador for damages - demanding compensation amounting to about $250 million - which amounts to more than 1 percent of the country's annual economic output.
El Salvador defended its actions, saying that Pacific Rim had submitted unsatisfactory feasibility studies and had failed to meet environmental requirements. The government added that the company only had usage rights in one section of the land required for its project.
Seven years later, in October 2016 - by which time Pacific Rim had become a wholly owned subsidiary of Australian venture OceanaGold - the ICSID dismissed the complaint, instead ordering OceanaGold to reimburse El Salvador's legal expenses of million.
Jose Luis Escobar Alas, archbishop of San Salvador, is one of the law's strongest advocates
Water versus gold
The dismissed lawsuit paved the way for current left-wing President Salvador Sanchez Ceren to go one step further and make mining for metals in El Salvador punishable by law. The draft bill was backed by 69 of the 84 members of parliament.
After the vote, conservative lawmaker John Wright Sol said the result showed "we have looked beyond party disputes. Today in El Salvador, water won out over gold."
Human rights groups and the Catholic Church also celebrated the decision.
Gold mining is also a dirty business: Poisonous chemicals such as cyanide, mercury and others are used to process gold ore, and their use carries with it the risk of toxic pollution for the soil and groundwater.
Water shortages in El Salvador has led to loss of livestock and poor harvests
Mining has a long tradition in many parts of Central and South America. Even before the arrival of the Spaniards, gold and silver were of significant economic importance. Deposits extend across the continents - from Tierra del Fuego to Alaska. Today, Brazil and Chile are the world's largest suppliers of iron and copper ore.
El Salvador is the first country to ban the extraction of metals. A similarly far-reaching law was implemented in Costa Rica in 2010, but it applies mainly to opencast mining. Elsewhere, in the Colombian department of Tolima for example, individual municipalities have successfully campaigned against mining concessions.
Juan Carlos Hidalgo, a Latin America analyst from Washington's Cato Institute, is skeptical that the parliamentary decision will benefit El Salvador in the long run.
"Mining is an extremely controversial activity in Latin America, because in many places it goes hand in hand with corruption, " he said. As a result, he added, regulations are sidelined, often to the expense of the environment.
Catholics join a protest in San Salvador against mining in their country
"It doesn't have to be that way, though, if there are adequate regulations that are implemented and complied with, " Hidalgo said. "Countries like Chile, for example, have shown it's possible."
Yet mining in Chile is not without problems - mining has led to water shortages there as well, against which local communities have protested, also in recent years.
Hidalgo puts the almost unanimous parliamentary decision down to heavy public pressure, and campaigning by environmental organizations and the Catholic Church. He warned that the law could ultimately harm the country economically because it may scare away investors.
Hidalgo says El Salvador's new law could also have wider implications in Central and South America. "The pressure from environmental organizations to ban mining is high throughout the region. And El Salvador certainly won't be the last country to prohibit mining."