In a ruling with statewide ramifications, the Pennsylvania Supreme Court on Thursday invalidated an Allegheny County law that restricted where convicted sex offenders could live, saying the ordinance would banish offenders to "localized penal colonies" with little access to jobs, support, or even their families.

The seven justices concluded that the Western Pennsylvania county law was at odds with the state's "Megan's Law," which requires convicted sex offenders across the state to report their residency so that nearby residents can be notified, but does not restrict where offenders can live.

Allegheny County's ordinance, enacted in 2007, went further, prohibiting such offenders from living within 2,500 feet of any child-care facility, community center, public park or recreation center, or school.

While the precedent-setting decision applied specifically to Allegheny County, an estimated 150 municipalities, mostly near Pittsburgh, but also in Bucks and Delaware Counties, have enacted similar laws as public-safety measures in the last few years. As of last year, there were more than 10,000 registered sex offenders in Pennsylvania.

Witold J. Walczak, legal director of the American Civil Liberties Union of Pennsylvania and one of the lawyers involved in the appeal, said those statutes might now be at risk. "It's very difficult to conceive how any would survive" under Thursday's ruling, he said.

Six convicted sex offenders challenged the ordinance in federal court, and their lawyers contended that the ordinance was so restrictive that it essentially meant there was nowhere in the county where offenders could reside and be in compliance with the law.

A federal judge in Western Pennsylvania invalidated the ordinance, and the county took the case to the U.S. Court of Appeals for the Third Circuit, which asked the state high court to decide the matter, since it involved state issues.

"This is a significant decision," said E.J. Strassburger, who represented the sex offenders who challenged the ordinance. He said the decision could have nationwide implications as well, since similar laws have been adopted in many parts of the nation.

Allegheny County Solicitor Michael H. Wojcik said he was disappointed in the court's decision, but did not expect to appeal. "There's really no appeal beyond this," he said.

In its unanimous ruling Thursday, the high court rejected the county's contention that it was merely trying to "augment" Megan's Law to address local concerns about public safety.

The justices said the county resorted to a "policy of exclusion and isolation" that was at odds with what the state legislature intended to accomplish when it enacted Megan's Law.

The ordinance, Chief Justice Ronald D. Castille wrote, "appears to attempt to ensure public safety, in certain parts of Allegheny County, by isolating all Megan's Law registrants in localized penal colonies of sorts, without any consideration of the General Assembly's policies of rehabilitation and reintegration."

But there must be an effort to balance the public's need for safety with the offender's need for rehabilitation, he wrote.

"Isolating all sex offenders from their communities, support systems, employment, and treatment is an approach contrary to that of the General Assembly, which requires individually tailored assessments and assistance with rehabilitation and reintegration for appropriate offenders," Castille wrote in the 23-page opinion.

In addition, he wrote that the law could have had an unintended impact of actually putting the community at risk by "depriving sex offenders of access to resources which have been shown to reduce the risks of recidivism."

Pennsylvania and other states enacted laws that came to be known as "Megan's Law" in memory of 7-year-old Megan Kanka, who was raped and killed July 29, 1994, by one of three convicted sex offenders who were living in anonymity across the street from the Kanka family in a suburban neighborhood in Mercer County, N.J.

Her killer, Jesse Timmendequas, was sentenced to death but is now serving a life sentence since the state did away with capital punishment.

In 2009, the New Jersey Supreme Court reached a similar conclusion as the Pennsylvania court has on the issue of residency restrictions, invalidating about 120 municipal ordinances, including one in Cherry Hill, that restricted where sex offenders could reside.

Contact staff writer

Emilie Lounsberry at elounsberry@phillynews.com.