IN A CASE involving Pleasanton, an Alameda County judge has sent a critically important message to communities across California: You can't just build commercial development and then force workers — especially low-income workers — to live elsewhere.

The state sets housing goals for regions of California and then, in our area, the Association of Bay Area Government divides the allotment between the cities in an effort to put homes near job and transportation centers — thereby reducing commute traffic and the resulting air pollution.

But the region has failed to keep up with those housing goals. Pleasanton was an exceptionally bad case because of a 1996 voter-approved housing cap that limited the number of homes built in the city to 29,000. As a result of the cap, the city, with a population of roughly 68,000, was unable to provide its required share of homes.

In his ruling last week, Judge Frank Roesch was clear: The state-mandated housing goals trump the local voter-approved measure. So the judge threw out the local housing cap, ordered the city to stop issuing most nonresidential building permits, and required that it make the zoning and land-use changes necessary to meet its housing requirements.

The latter point was critical: It sends a signal that cities cannot just put a plan on paper. They also must make necessary changes to their zoning and land-use rules so that developers don't have to jump through impossible hoops for permission to build the needed housing.

That's particularly important when it comes to affordable housing, as Bay Area statistics show. From 1999-2007, only 80 percent of the homes required by the Association of Bay Area Governments were actually built. The problem wasn't market-rate housing, for which actual construction was 137 percent of the ABAG allocation. The problem was affordable housing, for which a paltry 39 percent of the goal was reached.

Developers face numerous obstacles to building affordable housing. Finding funding can be a challenge. Finding land where they will be allowed to build is another hurdle. As Judge Roesch noted in his decision, state law mandates that cities must use their powers to facilitate new construction "that makes adequate provision for the housing needs of all economic segments of the community."

In other words, it's not enough to build single-family houses for the wealthier segment of a community. Affordable housing requires higher-density construction. That means that cities must set aside larger parcels near transportation hubs so builders can take advantage of economies of scale to erect reasonably priced homes. Planners call this "smart growth." Locals often disdain it and fight to block it.

Clearly, we need more of it if we hope to reduce car travel and provide housing for future generations. The judge's decision means that NIMBYism must give way to greater societal needs.