The state is stepping into the legal battle over a proposed condominium project in San Mateo to defend a California law that prevents cities from rejecting multiunit housing that meets their local building rules.

Attorney General Xavier Becerra filed Monday to intervene in an appeal of the case, in which a San Mateo County judge ruled to narrow the scope of the decades-old law. Developers and advocates for more housing construction have warned that the judge’s decision could have sweeping implications for the state’s ability to force communities to build their way out of California’s affordability crisis.

Becerra said the law, the Housing Accountability Act, is an important tool to ensure new housing is constructed throughout the state as California grapples with a multimillion-unit shortage. State officials estimate that more than double the current rate of production is needed to keep up with demand.