New Jersey's Supreme Court is giving state officials five months to rewrite affordable housing rules.

The justices struck down a "growth-share" formula approved by the Council on Affordable Housing that required towns to build additional affordable housing units only when new market-rate housing or commercial development was proposed.

The majority opinion in the 3-to-2 decision said that's not consistent with New Jersey's 1985 Fair Housing Act.

The New Jersey League of Municipalities, as well a number of individual municipalities, initiated legal  challenges to the regulations.

"Five years ago, municipalities were presented with housing requirements that were simply unachievable and irrational," said East Windsor Mayor Janice S. Mironov, who also serves as league president. "Today, the court's decision underscores the need and presents the opportunity for the administration, the Legislature and municipal officials to partner and craft a reasonable, fair and achievable housing policy."

The court's ruling is a victory for Garden State residents in need of housing, said Kevin Walsh, associate director of the Fair Share Housing Center.

"It makes sure that municipalities can't stand in the way of efforts to provide housing people can afford," Walsh said. "It's a decision that upholds the Mount Laurel doctrine and says that New Jersey's wealthier communities can't exclude working families and others."

The Mount Laurel doctrine requires that municipalities, though zoning and land use, provide an opportunity for construction of low- and moderate-income housing.

Walsh said the court's decision means it's likely towns will have to change their zoning to make room for new affordable housing.

"It's not something that's based on the municipal decision whether to grow or not, which is the sort of thing that under a home rule system can be abused by towns that want malls, but don't want workers to work in those malls to live in their town," he said.

Gov. Chris Christie's office is not commenting on the court's decision.