Following a contentious debate that divided the town, Milton voters Wednesday overturned a town meeting vote that created new zoning for multifamily housing, as required by the MBTA Communities Act.

Unofficial results show that 5,115 voters — 54% of those who cast ballots in the town election — were opposed to the new zoning, compared to 4,346 who voted in favor of keeping it.

“It's certainly disappointing to see the results where really just a margin of a few hundred voters in the town out of over 27,000 residents did vote to overturn a thoughtful and thoroughly debated zoning package,” said Jesse Kanson-Benanav of Abundant Housing Massachusetts.

The MBTA Communities Law requires all 177 cities and towns in the MBTA's service area to pass new zoning laws to permit multifamily housing units in dense areas, largely around transit stations. Milton was one of the first municipalities required to comply with the law.

Gov. Maura Healy said Milton is now noncompliant with the law and will begin to lose grant funding from the state.

“There is no greater priority than making housing more affordable. Today’s vote is disappointing, but we will continue to make the case for every community to embrace the opportunity that comes with creating more housing and making it more affordable for all,” Healey said in a statement.

Attorney General Andrea Campbell said she was disappointed in the outcome of the vote.

“My office has made it clear that compliance with the law is mandatory. When a municipality elects to evade its responsibility to comply with the law, we will meet our responsibility to enforce the law,” Campbell said.

Those behind the Milton campaign say they want to work with the state to comply with the law but they disagreed with the proposed zoning plans. They say they want to develop a different plan that minimizes the impact on neighborhoods. Denny Swenson, who helped organize the opposition, said the results show that residents don’t want to be told what to do by Beacon Hill.

State officials are concerned that the Milton vote could encourage other communities to consider not complying with the law which would be a big setback for Gov. Healey’s plans to produce more affordable housing. Many other municipal officials are following the "no" vote in Milton to see how far the state is willing to go to enforce the new law.