Record heat across California last weekend spurred Golden Staters to blast their air conditioners. The strain on the power grid was so great that California’s grid operator started rationing electricity. For the first time since the 2001 electricity crisis, it imposed rolling blackouts, shutting down power to hundreds of thousands of homes and businesses up and down the state.

The Wall Street Journal editorial board, among others, was quick to blame renewables for the blackouts. Because wind and solar plants only turn out power when the sun shines and the breeze blows, they wrote, they leave the state vulnerable to shortages. Even the president took time from his busy schedule to tweet about it.

While that line of reasoning may sound sensible, wind and solar aren’t really the problem. In a letter to California Gov. Gavin Newsom Wednesday, the heads of California’s energy agencies exonerated clean power in the most unambiguous terms.

“Collectively, our organizations want to be clear about one factor that did not cause the rotating outage: California’s commitment to clean energy. Renewable energy did not cause the rotating outages,” they wrote. “Clean energy and reliable energy are not contradictory goals.”

It will take time to conduct a thorough autopsy of the blackouts. Some observers have said the shutoffs were actually unnecessary, that the state had enough power to make it through the heat wave. Gov. Newsom has called for an investigation into the matter.

As officials noted in their letter, California relies on out-of-state utilities to supply electricity when demand peaks. That can be a problem during a heat wave. When it’s hot in California, it’s usually also hot in neighboring states. When homes and businesses all across the West are cranking their air conditioners, there is less surplus power to sell to California.

The remedy, California Independent System Operator CEO Steve Berberich told reporters, is “an overbuild of renewables and a fairly extensive deployment of batteries.” In other words, the state needs more clean power, not less.

While critics have said that recently shuttered gas and nuclear power plants were needed during the heat wave, it’s worth noting that gas and nuclear generators often struggle with high temperatures. Amid the scorcher last weekend, two California gas-fired power plants stopped supplying power, officials told reporters. The initial outage hit at the end of the day, just when gas plants start ramping up production, which suggests gas-fired power was at issue.

The irony of the attacks on California’s push for clean power is that, by moving to wind and solar, the state is trying to mitigate the threat that climate change poses to the grid. Last weekend’s heat wave toppled temperature records across the West, most notably in Death Valley, where the mercury hit 130 degrees F, the hottest temperature recorded on the planet in more than a century. The searing weather developed under a natural heat dome, which trapped hot air over the West. Recent decades have seen more and more of the most powerful heat domes.

“California is experiencing extraordinarily extreme and persistently hot weather conditions which, in turn, led to extremely high electricity use,” said Susan Tierney, a senior advisor at the Analysis Group and former assistant secretary of energy for policy. “The electric system, which is designed to produce power even under extreme conditions, can still feel the stress of simultaneous extreme events,” she added, referring to hot spells across the state.

As temperatures rise in California, air conditioning is growing in popularity. Between 1985 and 2015, roughly a third of coastal Southern California homes added air conditioners. The growth of air conditioning poses a formidable challenge for utilities, which are required to produce more electricity than their customers are likely to use to guard against unexpected swings in supply or demand. With rising temperatures fueling more heat waves, utilities might need to secure a bigger reserve of surplus power, California energy officials wrote in their letter. Hence the call for more renewables and more batteries.

Of course, hotter temperatures are also fueling more wildfires, like the hundreds burning around California right now. That further threatens the power supply as utilities may shut off electricity to prevent power lines from setting forests ablaze. One solution is more rooftop solar, which will allow homeowners to keep the lights on even when utilities cut the power. In California, new homes are required to have rooftop solar panels. Energy officials wrote that, going forward, the Public Utilities Commission will work to better integrate distributed energy, like rooftop solar, into the grid.

“I hope that this is a wake-up call to plan for tomorrow’s likely conditions, rather than yesterday’s,” Tierney said. “Sadly, but maybe helpfully, this is a preview of things to come.”

Jeremy Deaton writes for Nexus Media, a nonprofit climate change news service. You can follow him @deaton_jeremy.