Amid debates and lawsuits, natural gas bans keep gaining momentum as Bay Area cities encourage people to rely more on electricity for home appliances and less on fossil fuels.

On Thursday, the California Energy Commission unanimously approved new municipal building codes — which include strict policies for natural gas use in new homes — in Berkeley, Santa Rosa, Healdsburg, Windsor, Palo Alto, Los Gatos, Milpitas, Mountain View and Brisbane.

The policies take effect immediately.

“We fully support and welcome and encourage local government leadership to decarbonize the building sector. It’s been absolutely essential,” Energy Commission Chairman David Hochschild said at Thursday’s meeting. He said the commission approved the laws because they save more energy than state requirements, and have proved cost-effective. Constructing homes with only electric appliances can save money up front, according to a representative of the California Building Industry Association who spoke Thursday, but utility bills can be higher.

The movement against gas appliances has set off a complicated and contentious debate. While supporters of gas bans say that relying more on electricity is necessary to reach ambitious climate change goals, opponents point out that electricity is an unreliable source with the prospect of more public safety power shut-offs.

Roughly two-fifths of California’s electricity comes from renewable sources, including big dams, according to 2018 data. Ironically, from the perspective of gas bans, natural gas accounts for 35% of the state’s electricity.

Buildings account for about a quarter of the state’s emissions.

Of the new laws, Mountain View is the only city to require all new buildings to use only electric, rather than natural gas, appliances. Santa Rosa, Palo Alto, Windsor, and Los Gatos require new low-rise homes to be all-electric. Brisbane and Healdsburg require all-electric appliances except for stoves and fireplaces. Berkeley already banned gas in new low-rise buildings, but expanded its policies Thursday to require higher energy efficiency in new high-rise homes and nonresidential buildings — including steps to ensure that it’s easy to wire up electric appliances. Milpitas provides incentives for the construction of all-electric homes by requiring those that use gas to meet stricter energy efficiency standards than the state code.

Six cities also require more rooftop solar than the new state building requirements. Others push wiring for electric cars or battery storage.

The Energy Commission said that more than 20 environmental groups, as well as some energy companies — including Pacific Gas and Electric Co. and Sacramento Municipal Utility District — supported going electric.

“PG&E welcomes the opportunity to avoid investments in new gas assets that might later prove underutilized,” a company spokeswoman said at Thursday’s meeting.

San Jose, Menlo Park and San Mateo had already received approval to ban or limit gas in new homes. San Francisco prohibited gas in new city-owned buildings and wants to expand it to private construction as well. In January, the California Public Utilities Commission began drafting rules to “manage the state’s transition away from natural gas-fueled technologies” while ensuring safety and keeping rates steady, the agency said in a filing.

“The common theme is electrification, the state is going in that direction, and we want to be a party to that,” Bob Raymer with the California Building Industry Association said Thursday. He encouraged incentives that have helped the industry make “relatively balanced” changes in the past.

Kevin Messner with the Association for Home Appliance Manufacturers, whose members make both electric and gas appliances, cautioned the commission. He said gas dryers could be more efficient on a large scale than electric ones; alternatives to natural gas could be in the offing; and demand for gas stoves remains high.

“There is consumer interest in having a choice and having both,” Messner said.

Lawsuits filed against Bay Area gas bans are making their way through the courts. Last year, the California Restaurant Association sued Berkeley, and a developer filed suit against Windsor and Santa Rosa. His lawyer asked the commission to deny the new codes based on pending legal actions, but the commission did not heed the request and the codes took effect.

The restaurant trade group argued in its most recent court filing on Feb. 10 that Berkeley’s ban affects restaurant owners and chefs “who rely on natural gas for their manner and speed of food preparation and for an affordable and reliable energy source.”

Berkeley banned natural gas in all new single-family homes, townhomes and small apartment buildings; it plans to include commercial buildings.

“This ban will prevent members from occupying new restaurant buildings, since many restaurants cannot prepare their unique dishes without using gas, or will force them to alter their food preparation and bear higher costs,” the filing said.

Mallory Moench is a San Francisco Chronicle staff writer. Email: mallory.moench@sfchronicle.com Twitter:@mallorymoench