Voters had approved a ballot measure in 1996 capping the number of residences in the Silicon Valley city at 29,000. The city now has more than 27,000.
A schoolteacher seeking affordable housing and the nonprofit Urban Habitat program sued Pleasanton in 2006. They were joined in their suit last year by Attorney General Jerry Brown, who said the housing limits led to increased commuting, air pollution and greenhouse gas emissions.
Superior Court Judge Frank Roesch said the cap is preventing Pleasanton from complying with a state law requiring it to build its fair share of affordable housing.
Pleasanton officials could appeal the decision.
Information from: San Francisco Chronicle, http://www.sfgate.com/chronicle