A judge’s ruling in San Mateo County is raising fears among developers and advocates for more housing construction that the state will lose its leverage for forcing cities to build their way out of California’s affordability crisis.

The judge said the city of San Mateo was not obligated to follow a state law on housing approvals because it is a charter city — a system that gives local governments greater control over their own affairs. There are more than 120 charter cities in California and housing is tight in many of them, including San Francisco, Oakland and San Jose.

The ruling did not create a binding precedent for California. But it has prompted a legal challenge from groups concerned that it will make it easier for cities to reject new housing. It even caught the attention of Gov. Gavin Newsom, who called the ruling “misguided.”

“It’s a rotten fish. The longer it sits out there, the worst the stink is going to get,” said Matt Regan, senior vice president of public policy for the Bay Area Council. His organization, which represents businesses in the region, is pushing the state to intervene in the case.

The dispute began when several Bay Area housing groups sued San Mateo to force it to authorize a 10-unit condominium project on West Santa Inez Avenue near El Camino Real.

The San Mateo City Council rejected the development because it did not meet the city’s design guidelines for multifamily housing. The guidelines state that developers should set back any floors of a building that are higher than neighboring structures.

Groups that advocate for more housing development argued those design objectives were merely suggestions, not requirements. Because the condominium project otherwise met San Mateo’s zoning rules, they said, it should have been allowed under California’s Housing Accountability Act.

That decades-old law limits the ability of local governments to deny projects that meet their building criteria. The Legislature and then-Gov. Jerry Brown strengthened it in 2017 by raising the threshold for cities to prove a project does not qualify and allowing courts to fine those that flout the law.

But in November, Superior Court Judge George Miram sided with San Mateo in a ruling that challenged the legitimacy of the housing law altogether. As a charter city with constitutionally protected control over its local matters, Miram said, San Mateo did not have to follow the state housing law.

“This court finds that planning and zoning activities of local government are a classic municipal affair,” he wrote.

Miram objected to a provision that requires a city to approve a project as long as there is “substantial evidence” that it complies with municipal zoning rules. The judge said that gave City Council members no discretion over local development.

The decision stunned advocates who believe California cities need to build more housing. They contend that housing is a regional issue, because development decisions made by a city have ripple effects on surrounding communities, and that the state is the only entity in a position to override unreasonable objections to construction. They fear other charter cities will seize on the ruling to limit development.

The fact that Miram’s decision applied only to the San Mateo condominium project “doesn’t mean it’s not convincing or that it can’t be used by cities to deny housing,” said Dylan Casey, executive director of the California Renters Legal Advocacy and Education Fund.

His organization was among those that sued San Mateo. They have asked Miram to grant a new trial on their lawsuit, arguing that he didn’t give them a chance to address his concerns about the constitutionality of the Housing Affordability Act.

If the judge rejects the motion, the plaintiffs may appeal his ruling in the lawsuit — although an appellate decision against them would set a precedent that could be cited to challenge other state housing laws.

Casey said a separate ruling out of San Jose may bolster their case. Last week, an appeals court ruled that charter cities must follow a state law requiring government agencies that sell or lease public land to make it available first for affordable housing.

The Bay Area Council asked state Attorney General Xavier Becerra to request a rehearing in the San Mateo lawsuit. President and CEO Jim Wunderman warned in a letter that not challenging the ruling would “send a very clear message that the state has ceded the field in the fight to solve California’s housing crisis.”

“These kinds of decisions do set the tone for the kinds of discussions that take place with planning commissions,” said Regan of the Bay Area Council. “Every time we seem to get a little bit of a win on housing, make a little bit of progress on housing, we seem to get a ridiculous ruling like this.”

Becerra did not intervene before the deadline to seek a new hearing, and his office declined to comment. A spokesman for Newsom said the governor’s office is “closely watching this case and will formally engage at the proper time, if necessary.”

“California must have the tools to tackle the statewide cost crisis,” spokesman Jesse Melgar said in a statement.

Shawn Mason, city attorney for San Mateo, said development advocates were overstating the implications of the judge’s ruling. He said Miram merely rejected a broad interpretation of the Housing Accountability Act that the plaintiffs put forward in their lawsuit.

The plaintiffs argued that because a design consultant and city planning staff deemed the condominium project eligible under city rules, there was “substantial evidence” that San Mateo should have to approve the development. The city responded that it should not have its hands tied by unelected employees, and Miram ultimately agreed.

“Then you begin to wonder about what the point of public hearings are,” Mason said.

Mason said the Legislature needs to take more care in balancing local control over zoning and planning as it tries to stimulate housing development. But he added that it would be ironic if San Mateo became the face of this fight, since the city had not previously rejected a project in at least two decades.

From 2015 to 2018, San Mateo granted permits to more than 1,300 new housing units, though it must still approve nearly 1,800 more by 2023 to met a state-mandated target. It has met a tiny fraction of its housing goals for moderate-, low- and very low-income residents.

“We do a lot and we’re not an anti-housing city,” Mason said.

Alexei Koseff is a San Francisco Chronicle staff writer. Email: alexei.koseff@sfchronicle.com Twitter: @akoseff