On New Year’s Eve, while the rest of the world was preparing to ring in a new decade, employees of the German energy company EnBW were getting ready to pull the plug on one of the country’s few remaining nuclear power plants. The license to operate the two reactors at the Philippsburg nuclear facility expired at midnight after 35 years of providing carbon-free power to Germans living along the country’s southwestern border. The Philippsburg plant was the 11th nuclear facility decommissioned in Germany over the past decade. The country’s remaining six nuclear plants will go dark by 2022.

Germans have always had a complicated relationship with nuclear power, but the radioactive cloud that swept over Germany following the Chernobyl disaster in the mid-1980s gave new life to the antinuclear policies supported by the country’s Green Party. Following Japan’s Fukushima Daiichi plant meltdown, Germany’s antinuclear lobby kicked into high gear, and tens of thousands of people took to the streets in protest. The German government quickly passed legislation to decommission all of the country’s nuclear reactors, ostensibly to keep its citizens safe by preventing a Fukushima-style disaster. But a study published last month by the nonprofit National Bureau of Economic Research suggests that Germany’s rejection of nuclear power was an expensive and possibly deadly miscalculation.

To uncover the hidden costs of denuclearizing Germany, economists used machine learning to analyze reams of data gathered between 2011 and 2017. The researchers, based at UC Berkeley, UC Santa Barbara, and Carnegie Mellon University, found that nuclear power was mostly replaced with power from coal plants, which led to the release of an additional 36 million tons of carbon dioxide per year, or about a 5 percent increase in emissions. More distressingly, the researchers estimated that burning more coal led to local increases in particle pollution and sulfur dioxide and likely killed an additional 1,100 people per year from respiratory or cardiovascular illnesses.

Altogether, the researchers calculated that the increased carbon emissions and deaths caused by local air pollution amounted to a social cost of about $12 billion per year. The study found that this dwarfs the cost of keeping nuclear power plants online by billions of dollars, even when the risks of a meltdown and the cost of nuclear waste storage are considered. “People overestimate the risk and damages from a nuclear accident,” says Akshaya Jha, an economist at Carnegie Mellon and an author of the study. “It’s also clear that people don’t realize the cost of local air pollution is pretty severe. It’s a silent killer.”

Germany is unlikely to reverse course, but the study’s conclusions provide an important lesson for the United States, where the future of nuclear energy is increasingly uncertain.

The US fleet of nuclear reactors is rapidly approaching the end of its regulatory lifetime—almost all were built before 1990—and the only two new reactors under construction have gone way over budget. Cost overruns end up driving up the price of the plant’s already expensive electricity. In many energy markets in the US, nuclear energy struggles to compete with the glut of cheap natural gas and heavily subsidized renewables. Attempts to extend the lifetime of existing reactors, meanwhile, also run into economic and political hurdles.

Other than California, no states are aiming to phase out nuclear power entirely, but some plants may close down in the future simply because operators can’t afford to stay in business. The question, then, is whether the closure of these plants in the US will ultimately drive up carbon emissions, as it did in Germany.