But in the final days of negotiating the bill before it goes to the governor’s office, a controversial debate has erupted over a provision in Senate law that would allow 10 municipalities to ban fossil-fuel hookups in new buildings.

It’s a problem that’s dogged the state for years since Brookline first tried to ban new fossil-fuel hookups in 2019. Attorney General Maura Healey then pointed out that such a move violated state law. Since then, several communities have attempted to enact so-called “gas bans” via home rule petitions, but none have been implemented.

The measure proposed in the Senate bill would start a sort of pilot allowing Cambridge, Newton, Brookline, Lexington, Arlington, Concord, Lincoln, Acton, Aquinnah and West Tisbury to enroll.

Fossil fuel developers and prospects are pushing back hard. In an email blast to its members on Thursday, NAIOP Massachusetts, a lobby for developers and building owners, wrote: “FINAL CLIMATE LEGISLATION EXPECTED TO INCLUDE BANS ON FOSSIL FUEL – NAIOP NEEDS YOUR HELP.”

The reaction of the climate groups came quickly.

“We know the gas industry and its allies are organizing and communicating with lawmakers and opposing what we want,” Mothers Out Front organizers wrote on a website urging supporters to urge lawmakers to do so support ban and other priorities.

As of Friday noon, 250 members had used the site to email lawmakers, according to Andra Rose, who coordinates the Legislative Team for Mothers Out Front.

“Now is the time to stop this,” Rose said, referring to the state’s reliance on natural gas. “The way to stop this is through the least hanging fruit: new buildings and buildings undergoing major renovations.”

Tamara Small, NAIOP’s CEO, said there are risks to switching off fossil fuels entirely, including concerns that electrified heat sources will not be enough on the coldest days. She said full electrification could put a strain on the power grid and would increase costs for builders and homeowners.

“In short, while our members are successfully driving electrification of all product types, only hybrid electrification is currently feasible, particularly for office and laboratory properties,” she said via email, referring to a combination of gas and electricity.

National Grid spokeswoman Christine Milligan agreed, calling hybrid electrification “the most cost-effective and effective way for our customers and the Commonwealth to achieve our net-zero goal.”

But climate advocates — as well as Sen. Mike Barrett, a Lexington Democrat, the author of the Senate bill — said exceptions would be allowed for facilities like laboratories and hospitals, and that all-electric buildings are coming on stream across the region and are proving to stand up to the cold can withstand a New England winter.

They also wonder if it actually costs more to build an all-electric building.

It typically costs less to build all-electric, thanks in large part to new rebates from Mass Save, according to a report commissioned by the state Department of Energy Resources. For example, compared to a home built to the basic building code, a five-bedroom, all-electric single-family home in Worcester would save a builder $20,062 and the buyer $548 per year.

A large gas home, on the other hand, would cost the builder $3,184 more than the base, while saving the buyer $302 per year compared to a home built to the base building code. An all-electric small family home would bring even greater savings. A small single-family home that runs on gas would cost a contractor nearly $8,000 more than a home built to the basic code and cost the homeowner $496 per year. A 6-unit multi-family home also offered savings if it was all-electric.

According to the analysis, the only example that offered no savings if it were all-electric was a townhouse that could cost a builder $11,492 compared to the base code, but would still save the buyer $316 per year.

Advocates are noting that cities across the country are beginning to enact gas bans, in contrast to when Brookline first proposed its ban in 2019.

“This is not an imaginative concept that nobody can implement,” said Kyle Murray, a senior policy advocate at the Acadia Center, a clean energy organization. “New York City, one of the largest and economically strongest cities, just enacted a ban on new fossil fuel connections. New York is considering doing this statewide. DC is currently working on a ban on new fossil fuel connections. It’s not something that’s out of left field, crazy, not doable.”

In Cambridge, housing advocate Becca Schofield, co-chair of nonprofit A Better Cambridge and a developer of affordable housing, said she supports the fossil-fuel ban measure as long as the needs of people on low and middle incomes are not forgotten.

“The fear is that this would further limit affordable housing opportunities,” she said, adding that she would like to see exemptions for affordable housing developments. “Not that they’d use it,” she said. “In my own work, I don’t make new gas connections.”

Lawmakers technically have until the end of the month to finalize the bill, but they must send it to Gov. Baker’s office by Thursday if they want to ensure lawmakers have time to override a veto by the governor’s office, if one comes.

In late 2020, real estate industry concerns about the potential impact on the price of residential development helped Baker veto the state’s landmark climate law, which requires the state to cut emissions to half of 1990 levels by 2030 and by to reach net zero by 2050.

Baker, who has been vocal about his concerns about the lack of affordable housing and the housing shortage in general, did not comment on the new proposal to allow gas bans in 10 communities. “The governor will carefully review all legislation that reaches his desk,” spokeswoman Anisha Chakrabarti said.

However, activists fear that the question could again attract a veto.

“We can’t keep doing this — it’s not working for the health of people or the planet,” said Karl Mueller, a climate organizer at UU Mass Action and Mass Power Forward, who on Thursday and Friday was among the small group of activists who sing in the State House and call for climate protection.

“There’s a lot at stake and people need to see progress,” Mueller said. “It’s an incredibly dark time to be a lawyer and to care about the planet and justice. We have to keep moving forward.”

Sabrina Shankman can be reached at sabrina.shankman@globe.com. Follow her on Twitter @shankman.