It’s a chilling image : the sex predator skulking in the shadows of a swing set, waiting to snatch a vulnerable child.

Over the past two decades, that scenario has led to a wave of laws around the country restricting where people convicted of sex offenses may live — in many cases, no closer than 2,500 feet from schools, playgrounds, parks or other areas where children gather. In some places, these “predator-free zones” put an entire town or county off-limits, sometimes for life, even for those whose offenses had nothing to do with children.

Protecting children from sexual abuse is, of course, a paramount concern. But there is not a single piece of evidence that these laws actually do that. For one thing, the vast majority of child sexual abuse is committed not by strangers but by acquaintances or relatives. And residency laws drive tens of thousands of people to the fringes of society, forcing them to live in motels, out of cars or under bridges. The laws apply to many and sometimes all sex offenders, regardless of whether they were convicted of molesting a child or of public urination.

Lately, judges have been pushing back. So far in 2015, state supreme courts in California, Massachusetts and New York have struck down residency laws.

The Massachusetts ruling, issued on Aug. 28, invalidated a residency restriction in the town of Lynn — and by extension, similar restrictions in about 40 other communities statewide — in part because it swept up so many offenders, regardless of the actual risk they posed. Acting against a whole class presents “grave societal and constitutional implications,” the justices wrote. That unanimous ruling was based on the state Constitution.

The California Supreme Court went further, holding that a San Diego residency restriction, which effectively barred paroled sex offenders from 97 percent of available housing, violated the U.S. Constitution.

Far from protecting children and communities, the California court found, blanket restrictions in fact create a greater safety risk by driving more sex offenders into homelessness, which makes them both harder to monitor and less likely to get essential rehabilitative services like medical treatment, psychotherapy and job assistance.

It is understandable to want to do everything possible to protect children from being abused. But not all people who have been convicted of sex offenses pose a risk to children, if they pose any risk at all. Blanket residency-restriction laws disregard that reality — and the merits of an individualized approach to risk assessment — in favor of a comforting mirage of safety.