San Jose is set to become the largest city in the United States to ban natural gas from many new homes in direct contrast to the federal government’s rollback of environmental regulations.

On Tuesday, the City Council approved a proposal from Mayor Sam Liccardo and four of his fellow council members to create an ordinance barring natural gas in new single-family homes, low-rise multifamily buildings and detached granny flats beginning next year.

The proposal would not affect existing homes or high-rise developments.

“Electrifying buildings is not only good for the planet, but good for our health and safety,” the mayor, Raul Peralez, Lan Diep, Magdalena Carrasco and Dev Davis wrote in a memo.

San Jose is not alone in considering such drastic changes. In the last few years, California has moved to require new developments to be more energy efficient and environmentally friendly. And across the state, cities have begun to consider even stricter standards, like requiring new homes to rely on electricity, as they seek to combat climate change.

San Jose joins Berkeley and Menlo Park in enacting natural gas bans. Menlo Park’s ban carves out an exemption that will allow new one- and two-story homes to have gas stoves. But San Jose’s plan does not.

The vote came as President Donald Trump, who has scaled back environmental regulations aimed at limiting carbon emissions and advocated for coal, traveled through California Tuesday for campaign fundraisers.

Calling the city’s plan an “antidote” to Trump’s inaction on climate change, Liccardo said, “we know we’ve got a lot of work to do to address this crisis.”

City leaders also voted to require new buildings be equipped for all-electric operation, even if they continue to rely on other sources of energy in the near term, and, in some cases, solar power. And in a bid to encourage developers to go all-electric, the council said builders who choose to use natural gas should be held to higher energy efficiency standards.

In early 2018, San Jose announced that it would try to become one of the first cities in the country to reduce greenhouse gas emissions to the levels outlined in the Paris Agreement. Later that year, the city was chosen by Bloomberg Philanthropies to participate in a two-year program aimed at helping cities meet their climate goals. The city has launched its own community choice energy program and aims to produce enough solar power to run 250,000 homes by 2040.

Kimi Narita, with the Natural Resources Defense Council, has worked with cities, including San Jose, on their plans to go electric. Currently, buildings emit about a third of the city’s greenhouse gases.

“What San Jose does here shows leadership for other cities across the nation,” Narita said.

Advocates, who packed the council meeting, pointed out that building electric infrastructure from the start is more cost effective than retrofitting buildings later, and will improve air quality and safety.

Councilman Lan Diep said that as the city adds to its housing stock in the coming years to try to meet growing demand, it makes sense to build “sustainable” developments.

But Councilman Johnny Khamis said he’d heard from contractors worried the requirements could make building in an already expensive real estate market even more costly and increase utility costs.

“I would feel more comfortable if we delayed this,” Khamis said. “My whole goal is to not increase the price of housing.”

City staff and several council members pushed back at the idea the move could increase costs though, saying that the price of gas has become volatile and could rise significantly in the coming years.

“This policy is good for the environment and good for the economy,” said Councilwoman Dev Davis.

In a letter to city leaders, PG&E — which provides electricity and gas to San Jose residents — said it supports cities in their effort to “promote all-electric new construction when cost effective.”

Susan Butler-Graham, with the advocacy group Mothers Out Front, also thinks the change will help make the city safer and cleaner in the long term.

“Our kids will be living and working in these buildings long after we’re gone,” Butler-Graham said.

The mayor and council members also moved to require all new multi-family buildings to include more parking spaces where residents can charge electric vehicles.

“Particularly given the poorer air quality and higher asthma rates that we incur in many lower-income neighborhoods,” they wrote in their memo, “we must not lock out residents living in a multi-family setting from the benefits of EV usage.”

Councilwoman Magdalena Carrasco said she recently bought a plug-in hybrid mini van and understood the struggle of finding a place to charge her car.

“Now I understand the frustration,” Carrasco said, adding that she doesn’t want families to be dissuaded from purchasing electric vehicles because of a lack of charging stations.

Kerrie Romanow, the city’s director of environmental services, said the council’s decision is an important step toward preventing dangerous climate change.

“Things are getting worse and not better,” Romanow said. And today’s young people, she said, “are expecting us to do something.”