(Bloomberg) -- Electrifying all new cars in California could be an immense burden on the state’s struggling power grid -- or a whole new line of defense against blackouts.

It all depends on the time of day vehicles charge.

Governor Gavin Newsom’s executive order this week to phase out sales of new gasoline-powered cars by 2035 could add millions of electric vehicles to roads, driving up power demand as much as 9.5% in the next decade and 25% by 2035, according to estimates.

That could be a nightmare in a state where power supplies can be so tight on summer evenings that officials ordered rolling blackouts last month to prevent the system from collapsing during a heat wave. If millions of cars plug in at sundown, too, the problem may explode.

But think of each of those vehicles as a battery plugged in to the grid at strategic moments, and the picture changes. If they charge in the middle of the day, when California already has more solar energy than it can use, they could feed power back to the grid in the evening, when solar fades and supplies grow tight. Charging them later at night, when wind power peaks, would help, too.

“It could go either way,” said Erica Bowman, director of resource and environmental planning and strategy at utility Southern California Edison. “It really depends on planning.”

Getting home after work and plugging in a car to charge at 6 p.m. could lead to disaster. That’s just when everyone is also turning on air conditioners, electric stoves and televisions, and will likely cause a burden for the grid.

The state’s power plants, supplemented by electricity imports from other states, generally produce more than enough electricity. But solar power production plunges near sunset, forcing gas plants and imports to make up the slack. And if gas plants go down or imports are unavailable, supplies grow perilously thin. That’s what triggered last month’s rolling blackouts.

It’s not just heat that can cause unexpected outages. California utilities occasionally cut power in wide swaths of the state to prevent power lines from sparking wildfires during windstorms. This weekend, PG&E Corp. is warning it may need to cut power to parts of Northern California.

Californians bought just under 1.9 million cars and light-duty trucks last year, according to the California New Car Dealers Association. To meet that kind of demand through electric vehicles, more power generation will be needed.

Ramping up EV sales to meet Newsom’s target would increase electricity demand 9.5% by 2030, according to modeling by the Energy Innovation policy research firm. The California Solar & Storage Association estimates that by 2035, demand would grow 25%.

But those new cars -- and their batteries -- could bring their own benefits to the grid, helping stabilize it and shield against outages by feeding back power. California and its utilities are actively exploring how best to tap this new resource, referred to as “vehicle to grid.”

Right now, California utilities rely on price signals to influence when drivers charge their cars, with special rates that encourage charging at night or in the middle of the day. Taking things to the next level will likely require two-way communication between plugged-in cars and the grid.

“The car will talk to the grid. ‘It’s 6 pm. Wait 15 minutes, because I’m crunched a bit.’ You won’t spend a second thinking about it,” said Jules Kortenhorst, chief executive officer of the Rocky Mountain Institute, a non-profit focused on delivering a low-carbon future.

Newsom’s order doesn’t specifically mandate that all cars be electric -- only that they produce no greenhouse gas emissions. Fuel-cell cars that run on hydrogen would work, too. But they remain rare, with just under 7,000 registered in California by the end of 2019, according to state figures. In contrast, California had more than 308,000 electric cars.

To accommodate all of the new plug-in vehicles on the road, the state will need to move much faster in deploying electric charging stations, said Pedro Pizarro, chief executive officer of Edison International, owner of California’s second-largest electric utility. Edison’s program to install about 38,000 charging ports at a cost of more than $400 million -- which was recently approved by state regulators -- would only meet a small fraction of the state’s charging needs with an accelerated zero-emission car goal, he said. Shifting all new car sales to EVs will be a challenge, but not impossible, he said.

“It’s not doable a year from now, but it is doable a decade from now,” Pizarro said. “And that gives society time to deploy infrastructure for chargers and get consumers comfortable.”

©2020 Bloomberg L.P.