SACRAMENTO, Calif. (AP) — A record heat wave put California in a fossil fuel conundrum: The state has had to rely more heavily on natural gas to produce electricity and avoid power outages while Gov. Gavin Newsom’s administration moves toward ending the use of oil and gas.

The heat wave that started more than a week ago has been hotter and longer than any other in the state, and it put unprecedented strain on power supplies. That prompted Newsom to plead with people to use less power to avoid rolling blackouts — a practice that involves cutting some people’s power to save energy so the lights can stay on for everyone else.

The effort worked, but meeting the state’s heightened energy demand also required activating generators fueled by natural gas, which is still a major part of the state’s power picture. The Democratic governor’s calls for conservation also drew criticism about new state policies governing electric vehicles and other measures that will only increase energy demand.

Newsom, speaking to reporters Wednesday, said the “pretty extreme” circumstances required the state to turn to more natural gas as a backup supply.

“We all want to accelerate the elimination of the gas, but it’s a sober reminder of reality,” he said.

Tuesday’s demand for 52,000 megawatts set a record, as triple-digit temperatures blanketed much of the state. Sacramento hit a record high of 116 degrees (47 degrees Celsius), and normally cooler places like San Francisco and San Diego also reached sizzling temperatures.

Demand will only climb in the years ahead. By 2045, when the state is mandated to get all of its electricity from non-carbon or renewable sources, demand is expected to be as high as 78,000 megawatts due to more electric home appliances and cars on the road, according California Energy Commission estimates.

To meet that demand, both the government and major utilities like Pacific Gas & Electric are working to scale up renewable sources such as solar and wind power, as well as large-scale batteries that can store that power for use at night. The California Public Utilities Commission last year ordered utilities to procure enough additional power for 2.5 million homes by 2026.

Newsom just signed legislation aimed at keeping the state’s last nuclear plant open for five years beyond its planned 2025 closure, and he suggested Wednesday that the plant could run even longer if needed.

The sun is typically the state’s biggest power source during the day. But as the hot weather arrived, natural gas surpassed renewables for more time over the past week, according to the California Independent System Operator, which is responsible for managing and maintaining reliability on the state’s power grid.

Gas was the primary energy source all day on Tuesday — the expected peak of the brutal temperatures.

Meanwhile, on Monday the state for the first time turned on four gas-powered generators to add more supply, enough to power 120,000 homes. It planned to rely on some diesel-powered generators as well.

But some of the state’s fossil-fuel plants have their own reliability problems. Several power plants, including aging gas-fired ones along California’s coast, partially broke down or produced less energy than planned, according to the ISO.

Four of the plants, which suck up ocean water to cool down their equipment, were slated to close in 2020, but the state has continually extended their lives to help stabilize the power supply. They now plan to stay open until at least 2023, but they could last even longer under legislation Newsom signed in June.

If the state wants to keep the old coastal gas-powered plants online beyond 2023, it needs to give the companies that own them more certainty about the future so they can decide whether to spend money to maintain them, said Siva Gunda, vice chairman of the California Energy Commission, the state’s energy planning agency.

“Everything has to be moved forward at full throttle” with the “ambitious aim” that cleaner energy sources make up most of the state’s power reserves, he said.

The intensity of the heat wave only emphasizes the need for California to move away from fossil fuels as quickly as possible, he said.

The grid challenges also provided plenty of fodder for Newsom’s political critics, who have argued that Democrats’ policies to move away from oil and gas don’t add up.

The state recently adopted new regulations aimed at ending the sale of most new gas-powered cars in the state by 2035. But during the heat wave, officials also urged people not to charge cars or use other large appliances at night. The state has not banned car charging, but instead urged people to do so during the day.

“Gavin Newsom — You have to buy an electric car. Also Gavin Newsom — But you can’t charge it,” Republican state Sen. Melissa Melendez tweeted Tuesday evening after the state sent out an emergency wireless alert urging people to reduce power use.

Environmental groups say planning failures led California to rely on natural gas — and even ramp up its use — during the heat wave. The state needs to set clearer goals and benchmarks to meet its clean energy targets and ensure that fossil fuels aren’t used as a backup, said Ari Eisenstadt, campaign manager for Regenerate California, a campaign aimed at ending fossil fuel use in the state.

“Folks have been talking about natural gas as a bridge for decades,” he said. “And if it were truly a bridge, we would have crossed it by now.”

___

Associated Press journalist Michael R. Blood contributed reporting from Beverly Hills, Calif.