SAN FRANCISCO (AP) — California’s Supreme Court ruled Monday state corrections officials cannot prohibit all registered sex offenders from living within 2,000 feet of a school or park as required by a 2006 voter-approved ballot measure.

The court said the blanket restriction violates the sex offenders’ constitutional rights by limiting their access to housing, increasing the incidence of homelessness and depriving them of access to services such as psychological counseling that are available to all parolees.

READ MORE: LOOK: Crash Leaves Gardener's Pickup Truck Stuck Between Hollywood Hills Garage And Wrought-Iron Fence

The court restricted its analysis and decision to San Diego County, where the case originated. But the ruling has potential statewide impact.

“Blanket enforcement of the residency restrictions against these parolees has … infringed their liberty and privacy interests, however limited, while bearing no rational relationship to advancing the state’s legitimate goal of protecting children from sexual predators,” the court said in its unanimous decision.

The court did not strike down the law itself, saying sex offenders could still be forced to live more than 2,000 feet from schools. But it said the decision would have to be made on a case-by-case basis.

Deborah Hoffman, a spokeswoman for the state Department of Corrections & Rehabilitation, said the agency was reviewing the decision.

The residency restrictions were part of Jessica’s Law, which was approved by California voters in 2006.

READ MORE: High Winds Returning To LA Area Thursday

Supporters say it keeps children safe from sexual predators. But opponents say it forces offenders onto the street or away from their families, creating hardships that make them more likely to reoffend.

The ruling, which upheld an appeals court decision, came in a case brought by four registered sex offenders in San Diego County.

A San Diego County judge ruled in 2011 that the law violated the three men and one woman’s right to intrastate travel, to establish a home and maintain their privacy and was not specifically tailored to the each of their circumstances. The court ordered the state department of corrections to stop applying the residency restriction as a blanket provision against all paroled registered sex offenders who were under supervision in San Diego County.

A state appeals court upheld the decision, prompting the state Attorney General’s office to appeal to the State Supreme Court.

In a separate ruling on Monday, the court said the residency restrictions on sex offenders did not constitute punishment. They upheld a law that allows judges to require convicts to register as sex offenders even if a jury has not convicted them of a sex-related crime.

MORE NEWS: Shawn Smith, Suspect In Brianna Kupfer's Murder At Hancock Park Furniture Store, Arrested In Pasadena

(Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)