TRENTON -- New Jersey has to build thousands more units for its low-income residents to make up for the 16 years that the state didn't address those needs, the state Supreme Court ruled Wednesday.

In a decision addressing New Jersey's long-stalled regulations governing affordable housing, the state's highest court said towns must take into consideration the need for housing that existed within their borders between 1999 and 2015. That's the so-called gap period when the Council on Affordable Housing failed to adopt new rules.

The 6-0 decision, the latest in decades of Mount Laurel rulings governing affordable housing in New Jersey, rejects the assertion that only 37,000 units are needed and that the gap period calculations are not necessary because that need no longer exists.

"The decision says that the promise of the Mount Laurel decision is real for tens of thousands of families and people with disabilities and the New Jersey Supreme Court said our commitment to fight discrimination remains good law," said Kevin Walsh, executive director of Fair Share Housing Center, the advocacy group that has taken the lead in enforcing Mount Laurel obligations.

Because of the ruling, more than 200,000 housing units must either be built, rehabbed or converted for low- and moderate-income residents, Walsh said.

For some towns, that means their obligations may increase. For others, it means a potential decrease, he said. Walsh said staff will be working in the coming weeks to calculate how that affects each town still with outstanding obligations.

However, Michael Cerra, assistant deputy director for the New Jersey State League of Municipalities, said the figure won't be that high.

"The decision is the court's attempt to forge a middle-ground compromise," Cerra said.

He said that while permitting the gap-period calculations, the decision doesn't allow Fair Share Housing to use its complete formula -- such as including deceased residents and households that are no longer income eligible.

Cerra said the concern now is that the ruling will create such confusion that Fair Share Housing and towns will end up back before the Supreme Court, but this time to argue over how to reach a final figure.

"Our concern is this will create a very bureaucratic and costly process and just begs the question for the legislature to step in and correct it," Cerra said.

This latest battle grew out of an attempt by 13 towns in Ocean County to exclude those gap years from calculations of their affordable housing obligations.

Supported by the New Jersey State League of Municipalities, they argued those gap years shouldn't be considered because the needs during that period no longer exist.

A trial court judge last year said those years should be included but a state appellate panel said they shouldn't. The Supreme Court agreed to take up the issue and put it on an expedited track, hearing arguments on Nov. 30.

The Supreme Court on Wednesday said that although those years have passed and new household patterns have formed, the need for affordable housing for many of those residents has not decreased. The Supreme Court called that a pent-up need.

"We hold that towns are constitutionally obligated to provide a realistic opportunity for their fair share of affordable housing for low- and moderate-income households formed during the gap period and presently existing in New Jersey," Justice Jaynee LaVecchia wrote in the 32-page decision.

The court took over regulation of the state's affordable housing in 2015 after the state Council on Affordable Housing failed to meet and didn't adopt new rules for a third round beginning in 1999.

Some towns viewed that as an invitation to not address their obligations, prompting Fair Share Housing to sue. Since then, the court has said towns can seek protection from a suit by obtaining from the court a certification that it is working to meet those obligations.

Barnegat and 12 other Ocean County communities were among some 330 towns that sought that certification. But when the trial judge addressing the Ocean County cases said they had to include the gap period in their calculations, those 13 towns balked. As the appeal of that lower court ruling moved through the courts, all but Barnegat settled with Fair Share Housing.

Of those 330 towns that filed for certification, about 100 have settled and another 30 or 40 are close to settling, Walsh said. Nearly 40 are showing signs they want to go court, he said.

The first of those trials -- involving Hopewell, Princeton, East Windsor, West Windsor and Lawrence -- currently is under way in Mercer County Superior Court.

Chief Justice Stuart Rabner did not participate in the case.

MaryAnn Spoto may be reached at mspoto@njadvancemedia.com. Follow her on Twitter @MaryAnnSpoto. Find NJ.com on Facebook.