The New Jersey Supreme Court said the state must rewrite its affordable housing rules to again give each town a number of homes it is responsible for.
Thursday's ruling is the latest in a decades-long legal battle over housing low- and moderate-income residents.
In a 3-2 ruling, the court rejected the state's latest regulations, which would require towns to include zoning for housing for lower-income residents only if they actually had new development.
The court said the new approach is not consistent with the state's Fair Housing Act.
The justices gave Gov. Chris Christie's administration five months to come up with new requirements for how much housing towns must provide through their zoning regulations.