California is on the verge of making a very risky bet, one that threatens the state’s prosperity and environment, and its contribution to global climate progress.

Last week several groups joined with Pacific Gas & Electric in an agreement to close Diablo Canyon in fewer than 10 years. The deal doesn’t have much to do with global warming. Instead, it has everything to do with picking an energy mix that has a risky lack of diversity, and is going to be very complex, expensive, and unlikely to help our climate goals.

Others should pay attention, because elimination of more than a quarter of California’s carbon-free generation is unlikely to reduce carbon emissions, and may produce nasty consequences, like reduced reliability of the electric grid, and vulnerability to big swings in natural gas prices.

What is truly distressing about the proposal is that the state’s goal of promoting renewable energy is pitting carbon-free sources of electricity against each other, and squandering tax dollars and ratepayer dollars to do it. (To be fair, some of these dollars come from California itself, but some come from federal taxpayers too.)

This is not a good idea. All the wind, all the solar and all the nuclear energy we can reasonably hope for still may not be enough to get us to our carbon goals, so new carbon-free generation should be displacing fossil generation, not other zero-carbon generation.

To comply with California’s “renewable energy portfolio” rule, every kilowatt-hour produced from wind or sun must be used, regardless of the need. Otherwise, the wind or sun would have to be “curtailed,” or not used.

Giving first priority to power from wind and sun can lead to perverse consequences, since sometimes the generation they displace is also carbon-free, e.g. nuclear. A key goal of closing Diablo Canyon, according to the joint proposal, is to “reduce the need for periodic curtailment of RPS resources.”

So killing Diablo Canyon is good for wind and solar owners. But it doesn’t do much to reduce greenhouse gases, or to help California consumers, who are already burdened with the highest electricity prices in the western United States, nearly 50 percent above the national average.

We’re going to need a lot of renewables, but it is clear from major studies that there are practical limits at very high levels of renewable generation, because their production is not in sync with demand.

Therefore, we will need to re-configure the rest of the electric system in complex and expensive ways. As MIT found last year in its “Future of Solar” study, the energy comes concentrated in such short periods that it loses much of its value, because it creates an unusable surplus. Once the system is producing surpluses of wind and solar energy, then adding even more contributes very little to cutting carbon dioxide.

Wind has similar difficulties.

And both wind and sun need to be backed up with something else. Based on recent experience, the something else is natural gas, which is dirtier and can be expensive.

Take what has already happened in California, for example. The California Air Resources Board said in 2014 that the state’s carbon dioxide emissions had increased by 9 million metric tons in the 12 months following the 2012 closure of two San Onofre reactors in Southern California.

In Wisconsin, emissions jumped more than 15 percent following the shutdown of the Kewaunee nuclear facility. In New England, emissions increased by 7 percent in 2015 compared to 2014 because of the shutdown of Vermont Yankee. (And they will jump again in 2019 when Entergy’s Pilgrim reactor closes in Massachusetts.) California, an electricity importer, can avoid increasing its carbon emissions if some of the natural gas is burned in Mexico or elsewhere outside its borders. But that makes no difference to the planet’s climate.

The proposal does not even pretend to find enough carbon-free replacements. It says that 2,000 gigawatt-hours will come from carbon-free resources and 2,000 gigawatt-hours will come from efficiency. That’s ambitious. However, last year the Diablo Canyon reactors produced 18,500 gigawatt-hours, four and a half times more than the specified replacements. That’s a very big gamble.

We don’t need wind and solar so much as we need a low carbon energy system, planned and operated from a system perspective, optimizing cost, reliability and emissions. Closing Diablo Canyon doesn’t move us in that direction.

The next few years in California will be telling.

The anti-nuclear lobby says that a future primarily powered by renewable sources of energy is upon us. We’ve done the math, and the equation doesn’t balance. Rather, this seems more like a flawed experiment that will put greater pressure on consumers through higher electricity prices while increasing, not decreasing, CO2 emissions. It’s not a gamble that others should try.