FOR THE SECOND TIME  in less than two years, Attorney General Maura Healey on Friday rejected bylaws approved by the town of Brookline placing restrictions or prohibitions on buildings incorporating fossil fuel infrastructure.

As she did in 2020, Healey went out of her way to say she agreed with the intent of the proposed bylaws approved by town residents last year — to reduce greenhouse gas emissions from the burning of fossil fuels.

But the attorney general, who is now a candidate for governor, said her statutory obligation to review the legality of bylaws prevents her from taking policy issues into account. She said her review concluded the bylaws were preempted by the state building code and a law giving the Department of Public Utilities oversight of the sale and distribution of natural gas in Massachusetts.

“The attorney general supports the town’s efforts to reduce the use of fossil fuels within the town,” Healey said in a letter to Brookline officials. “And the attorney general notes that pending state actions may provide the town with greater latitude in the near future. However, the Legislature (and the courts) have made plain that at the present time the town cannot utilize the methods it has selected to achieve those goals.”

The decision comes at a time when the Baker administration is proposing new building codes for the state. The proposal would not allow individual communities to ban fossil fuel infrastructure in new construction or major rehabs.

In 2020, Healey rejected a Brookline bylaw that would have barred the installation of most fossil fuel infrastructure in any new buildings or significant rehabs of existing buildings.

In response, town residents last year passed two new bylaws. One would have required anyone seeking a special permit to go beyond the base zoning code for new construction or a major rehab to either go fossil free or accept a permit that would expire in 2030 and require gas appliances to be removed at that time. The other bylaw would have barred fossil fuel infrastructure in any new building or major rehab in a special zoning overlay district in North Brookline.

Healey’s office said both bylaws conflict with laws giving the state authority over such matters, but the attorney general noted those laws are in flux.

In compliance with a law passed last year “creating a next generation roadmap for Massachusetts climate policy,” the Baker administration earlier this month released proposed revisions to the state’s existing building codes (a base code and a stretch code) and a new opt-in net zero specialized stretch code.

The opt-in code would allow municipalities to require new homes or commercial buildings using gas to achieve greater energy efficiency and also mount solar on the roof and pre-wire the building for full electrification. The new code would not allow municipalities to ban fossil fuel infrastructure.

Kathleen Theoharides, the governor’s secretary of energy and environmental affairs, said the administration’s proposal seeks to strike a balance between energy efficiency and cost. She said she opposes an outright ban on fossil fuel infrastructure in new construction even in individual communities that want to do so because such bans could hinder housing construction and because they could leave a smaller pool of customers carrying the financial load for the remaining natural gas system.

“We need to make a transition [away from natural gas], but it needs to be an orderly transition,” she said. “We think we have to do this with a high level of care when we’re transitioning away from a system that still exists all across the state.”

Lisa Cunningham, an architect and Brookline Town Meeting member who helped lead the effort in support of the new bylaws, said Beacon Hill is taking too much time to address climate change.

“While the timeframe that we have to reduce emissions is rapidly closing, our state agencies continue to debate and delay,” she said in a statement. “We hope the state Legislature and the Department of Energy Resources will continue this forward progress, stop enabling special interests, and get to work passing legislation and regulations that will actually prevent catastrophic climate failure. If not, future generations will judge us harshly – and rightly so.”

A shift to heat and hot water generated using electricity is consistent with the state’s long-term plan for reducing greenhouse gas emissions. That goal revolves around using electricity to power vehicles and heat homes and businesses while moving the regional power grid away from power plants running on natural gas and relying instead on electricity supplied by offshore wind farms, solar, hydroelectricity, and nuclear power.

According to a dashboard maintained by the New England power grid operator, the region has a long way to go to reduce its reliance on fossil fuels. As of Friday afternoon at 2:30, 45 percent of the region’s power was coming from natural gas power plants, 25 percent from nuclear plants, 10 percent from oil, 10 percent from hydro, 8 percent from renewables, and 3 percent from coal.