One of the most extreme heat waves in generations is smothering California this week and pushing the region’s power grid to the brink of collapse.

In the past 72 hours, the state has instituted the first rolling blackouts since the 2001 energy crisis to protect a system strained by a crush of demand for air conditioning. The region’s electricity system operator has warned of more rotating outages through Wednesday with temperatures forecast to reach as high as 112 degrees Fahrenheit (44 degrees Celsius) in some parts of the state.

Part of the problem is California’s rapid shift away from natural gas. More than 7 gigawatts of gas generation, enough to power 5.3 million homes, has been retired over the past five years as the state turns increasingly to renewables, according to BloombergNEF. That leaves fewer options when the sun sets and solar production wanes.

Normally, California can import enough power from neighboring states when supplies are tight. But the sprawling heat wave blanketing the U.S. West is pushing power plants to the hilt across the region.

“California is in a tight spot,” BNEF analyst Brian Bartholomew said. “It’s retired a lot of gas. And the storage that’s supposed to help hasn’t yet come online.”

By 8 a.m. local time it was already 83 degrees in Sacramento. With temperatures climbing, demand for power in the state is expected to reach more than 49,700 megawatts Monday afternoon, just shy of the all-time record set in 2006.

Since Friday, millions of Californians have been abruptly plunged into darkness with little notice as utilities work to keep the state’s grid from collapsing. With Covid-19 still spreading, the powerless have faced a difficult choice between enduring the heat at home and seeking relief elsewhere in a state that’s reported more infections than any other. These blackouts are hitting less than a year after California’s utilities deliberately cut power to millions to keep their electrical lines from sparking fires during unusually strong windstorms — all extreme weather events made more frequent by climate change.