In two very different parts of North America, two rivers are being transformed. Over the past six years, engineers have steadily corralled the Reventazón River in eastern Costa Rica behind a 130-meter-high dam, completed as of the end of March. Once it’s fully online later this year, the Reventazón dam will be capable of generating 305.5 megawatts of electricity, enough to power over 500,000 homes. It’s the largest hydroelectric project in Central America, and it all but guarantees that Costa Rica’s electric grid will run off nearly 100 percent renewable energy for the foreseeable future.

Meanwhile, in California and Oregon, the Klamath River has been bottled up behind a series of four dams for nearly 60 years. Together, those dams generate an average of 82 megawatts of power. But while that energy may be renewable, it’s not free of environmental consequences. The dams make it impossible for salmon and other migrating fish to access more than 400 miles of the Klamath. Toxic algae flourishes in the stagnant reservoirs, creating water quality problems downstream. The Klamath dams took a healthy, dynamic river ecosystem and replaced it with a shadow of itself. In April, a coalition of government agencies, American Indian tribes, environmental activists, and even the dams’ owner decided it’s not worth it anymore. The Klamath dams are coming down.

The Reventazón and Klamath dams seem to be telling opposite stories about hydropower’s place in the world. In the first, hydroelectricity makes it possible for countries to move away from fossil fuels and toward a carbon-zero future, making a vital stand against climate change. In the second, dams are understood to be so destructive to local ecosystems that the best thing a society can do is demolish them and never look back, even if it means replacing a bit of renewable hydropower with burning fossil fuels.

Both make legitimate claims to be doing what’s best for the environment. And both are emblematic of current trends. Dams are going up all over Latin America, Africa, the Middle East, and Southeast Asia. At the same time, they’re coming down all over the US. Thinking about hydropower in 2016 can feel like falling through the looking glass, where the opposite of environmentalism is…still environmentalism. Are dams the future or the past? Should countries be building them up or tearing them down? Will dams save the planet or destroy it?

The Boom

Back in 2014, a team of environmental scientists in Germany set out to count all the hydropower dams being built in the world. They trawled scientific studies, newspaper articles, energy sector reports, NGO investigations, and more. Their final number was staggering: 3,700 dams with a capacity of at least one megawatt were in the middle of serious planning or construction. If all these dams went online, they would increase global hydropower capacity from 980 gigawatts in 2011 to 1,700 gigawatts in under two decades.

Some of these planned dams will be so locally destructive that it’s hard to even think of them as “green.” Look no further than the hundreds of dams planned in the Amazon basin, which will disrupt the delicate and still mysterious hydrology of the ecosystem that currently does the most to protect the world from climate change. These dams will be unmitigated environmental disasters, if they come to fruition.

But that made them less interesting when it comes to questions about the environmental ethics of hydropower. Poorly designed, hastily constructed dams in the middle of precious, pristine ecosystems are obviously bad for the environment. The more important question is if state-of-the-art dams—the ones that are thoughtfully engineered and carefully built, by teams that take their environmental and social impacts seriously and truly do their best to mitigate them—could ever really be good for the environment.

That’s where Reventazón comes in. I first heard about it while reporting a story on Costa Rica’s carbon-zero streak last year. The country’s energy grid didn’t burn a single fossil fuel for over 75 days, and it was all thanks to dams (and a particularly wet rainy season that kept them juiced up). Hydropower supplies about 80 percent of energy in Costa Rica, with other renewables like wind and geothermal filling up an increasingly large share of the gap. (It’s important to note that Costa Rica is not making the same mistake as Venezuela, which is suffering from an extreme energy shortage after a drought crippled its most important dam. Costa Rica’s grid is diversified, and it has the option of burning fossil fuels when it absolutely needs to.)

Getting off fossil fuels is a top priority for the Costa Rican Energy Institute, the national energy utility, says Gravin Mayorga, a civil engineer who worked for the utility for over 35 years and specialized in hydroelectric projects. “[Costa Rica] is a green country, and we hope to be able to achieve 100 percent of energy production with renewable sources,” he says. “That’s easy to say, but actually making it happen and sustaining it over time is quite difficult.” Hydropower is the only reason that Costa Rica even has a shot at that goal.

The country is conscious of trying to keep the environmental and social price of a new dam low. Reventazón, for example, was built in a watershed that’s already peppered with dams, so it didn't destroy a virgin river. The Caribbean side of Costa Rica is relatively undeveloped and underpopulated, so not many people needed to be moved out of the dam’s way, and construction jobs went to locals. The Energy Institute also committed up to $1.6 million to preserve nearby forest as a wildlife corridor for jaguars and other animals. Preserving lush forests around Reventazón is actually vital to its success, Mayorga says, since the trees keep sediment from eroding into the reservoir and clogging up the dam.

Mayorga doesn’t gloss over the environmental costs of Reventazón. He just sees them as a small piece of a much bigger picture. “I don’t doubt that whatever energy the Reventazón hydroelectric project provides to the country is going to be very positive, because it’s going to replace thermal energy,” he says. As the world comes out of the hottest month on record (yet again), it’s hard to argue with that.

But there’s a specter casting its shadow over Reventazón from the north: the US’s dam removal movement. It’s impossible not to wonder if Reventazón (and the rest of the 3,700 dams planned in the developing world) is doomed to be destroyed, and after just a few decades of operation. The thought has certainly crossed Mayorga’s mind. “The dam removal discussion is a font of information of us—and a mirror for what we could be living in the future,” he says.

The Bust

Between 1915 and 1975, 46 dams in the US came down. Between 1976 and 2014, that number jumped to 1,040, with 548 of those removals happening since 2006. Meanwhile, out of those 3,700 planned dams in 2014, not a single one was located in the US. The US has come down with dam removal fever just as the rest of the world is catching the hydropower bug. Why?

The biggest reason is that most of the dams in the US are old. Some have been impeding rivers for over a century. “This country has some pretty ancient dams,” says Dennis Lynch, a hydrologist at the US Geological Survey who is managing the Klamath dam removals. “It’s not a big surprise that some of them are filled with sediment or need some upgrades.”

Dams must be relicensed by the government every 30 to 50 years or so, and every time, their owners must make sure they comply with the latest regulations. Before the 1970s or so, for example, you could build a dam that completely blocked fish from passing through it. But to get it relicensed today, you’re going to have to go back and put in a fish ladder. That’s the kind of retrofitting Pacificorp would have to do to keep the Klamath dams up-to-date and within the law. But those fixes are expensive, and often dam owners will decide it just isn’t worth it to keep aging infrastructure limping along. Better to just blow it up and walk away.

When dam removals first got going in earnest, no one was quite sure what would happen to the rivers afterward. Would they be permanently damaged from all those decades plugged up in a reservoir? Would the fish and animal species come back? And where would all the sediment in the reservoir go? Would it smother the river before it even had a chance to be reborn? Those are reasonable fears, but they’ve proved largely unfounded, says Jim O’Connor, a USGS geologist who studies dam removal. “In general when dams have come out, the river has basically reconnected,” he says. Sure, there can be a lot of sediment at first, but it is pretty quickly ends up rebuilding river banks and being carried downstream. Fish and animals return so naturally it’s like they’d never left. “These systems are resilient. They recover quickly,” says Lynch. When it comes to planning for the Klamath removal, “we don’t know exactly what will happen when we take these dams out. But we can’t point to any cases where it’s like, wow, that was sure a big mistake.”

Should the US be learning from Costa Rica’s success and start building more state-of-the-art dams to replace the ones they’ve removed?

So by and large, removing a dam seems to do exactly what you hope it would: restore a river. But when you’re talking about removing a hydroelectric dam, there is often a more abstract environmental cost. Removing the Klamath dams, for example, “does increase the greenhouse gas emissions, because you move from something that really was producing very little greenhouse gas to a replacement energy that would certainly have some fossil fuel consumption associated with it,” Lynch says. “It is part of the calculation, definitely.” O’Connor wonders if that calculation might be changing as the need for renewable energy becomes more urgent. He points out that the surge in dam removals began before anyone was particularly concerned about climate change. “The decision might be different if the process was starting now,” he says. “It makes me wonder if the pace of removals may decline.” (In a sad twist, climate change might even lead to a new dam building boom in the US, if prolonged drought makes it necessary to store more water.)

Reventazón is certainly much better planned than many of the US’s aging dams, which bodes well for a long and productive life. And it’s reassuring that even if it does have to come down someday, the river would likely recover. Costa Rica has clearly learned from the US’s mistakes. Which raises the question: should the US be learning from Costa Rica’s success and start building more state-of-the-art dams to replace the ones they’ve removed? The problem is, most of the good spots for truly astounding hydroelectric dams are already taken. The US isn’t in any rush to remove those; indeed, they’re the ones that get those expensive upgrades.

Most of the dams that have been removed or are up for removal are actually pretty small; some were first built for things like powering local mills and don’t contribute any hydropower or flood control benefits today, so there would be no point in replacing them. The Klamath dams fall somewhere in-between; they do produce hydropower, but not much, and at a great costs to the ecosystem and the people who have traditionally relied on it. And when it comes to those types of dams, the US’s environmental calculus has simply changed since the middle of the 20th century. (See also: all those new environmental laws that require those upgrades in the first place.) Healthy rivers are more important to us than they were when the dams first went up. Better to look forward to incorporating more solar and wind into the grid, like California is already doing, than default to a destructive and expensive dam.

It’s tempting to turn all this into some simple formulas: 82 megawatts of renewable energy < a healthy Klamath River, a carbon-zero Costa Rica > an intact Reventazón River. But those are just the decisions we’ve made today, based on subjective and shifting priorities. That doesn’t mean we must make the same decisions tomorrow.