The creation of the bylaw comes on the heels of a controversial plan proposed in October by Citizens Energy Corp. of Boston (CEC) for a 2-megawatt, 8,276-panel solar installation on 18 acres of land owned in town.

The plan garnered substantial anger from abutters who sought redress from the Zoning Board of Appeals. However, with no laws on the books to address or regulate solar installations in town, the ZBA unanimously ruled that a permit issued to CEC by the Hatfield building inspector was properly granted.

“This bylaw was put together by the Energy Committee with input from a group of citizens,” Robert T. Bartlett Jr. of the Planning Board explained. “It would require a special permit issued by the Planning Board, and a site plan review. Without this bylaw we have no regulation at all.”

Stanley Pitchko of Prospect Street urged voters to support the bylaw.

“Is it perfect? No, it’s not. But if we vote this down, every open space in town would be susceptible to solar development,” Pitchko said.

Requiring a two-thirds vote to carry, the article passed 172 to 4.

Voters decided to table an article that would have used Community Preservation funding for a housing mortgage program, designed to help low- to moderate-income seniors secure affordable homes.

As proposed, the program would enable two low- to moderate-income senior households to purchase condominium units in Hatfield. The units would be sold with a deed rider that would guarantee they be designated affordable housing in perpetuity.

The total request for the project was $270,200. Several voters said they preferred to table the issue until further study could be done on using the town’s vacant Center School as senior housing.

Voters also approved a moratorium on medical marijuana dispensaries and on marijuana treatment centers until June 30, 2014.

Voters also allocated:

∎ $19,290 of Community Preservation funds to preserve, rehabilitate, and restore the Hatfield Historical Museum collection;

∎ $32,140 for a five-year lease program for a new police cruiser, DPW truck loader and a COA van;

∎ $41,125 to fund a new roof for the Highway Department garage;

∎ $60,000 to upgrade and rehabilitate the wastewater treatment plant and pump stations; and