CHICAGO - Paul Murphy was originally sentenced to three years of probation after his conviction in 2011 on charges of aggravated child pornography.

Murphy is impoverished and homeless. And after he was found violating his parole by sleeping in the doorway of a church, Murphy was ordered to serve his sentence in prison.

He finally was approved to be released from custody in March 2014, into the state's mandatory supervised release program.

But because he is homeless and cannot find a place to live that satisfies the myriad restrictions and regulations, Murphy, 61, remains in prison. And unless he somehow finds housing that satisfies the state's strict limits, Murphy is doomed to spend his life in prison regardless of what his original sentence had been.

Murphy is one of seven inmates who have turned to the federal courts, contending that Illinois is improperly keeping sex offenders in prison even after they have served their full prison sentences — with the possibility they might never be freed.

Their class-action lawsuit charges Illinois Attorney General Lisa Madigan and Corrections Department Director John Baldwin with improperly keeping sex offenders in prison by imposing conditions for their housing that makes it impossible to win release.

"We're going to fight vigorously to try to change some of the circumstances to which these people are subjected," said Mark Weinberg, co-counsel for the prisoners.

A spokesman for the Department of Corrections said the state is still readying its response to the lawsuit.

At issue are both the restrictions of the law, as well as the Department of Corrections interpretation. Sex offenders cannot live in nearby parks, schools or day care centers. They cannot live in a condominium or apartment or trailer park where another convicted sex offender lives, with the one exception a halfway house. But there are no halfway houses in Illinois that accept sex ­offenders.

According to the lawsuit, about 4,000 Illinois prisoners convicted of sex related crimes have been sentenced following the end of their prison terms to serve three-years to life of mandatory supervised release.

Prisoners who receive that indeterminate sentence can only apply to be released from the strict supervision after serving three years outside of prison.

But a growing number of prisoners who have completed their sentences find they cannot get released to begin the three-year clock ticking; as a result, the lawsuit contends, the "vast majority of prisoners" who have completed their terms end up denied release, "serving what amounts to life sentences in prison."

The lawsuit contends the law's restrictions are exacerbated by the strict interpretations of the Department of Corrections on whether a site is suitable for release under the program. Among the restrictions, the lawsuit cites: The department routinely prohibits sex offenders from serving their mandatory supervised release at any host site where any resident has a computer or smartphone with internet capability.

Jason Gustafsen, 32, was convicted of aggravated child pornography in 2013. He served his prison sentence and, with good time credits, was approved for the mandatory supervised release program in October 2014. But his mother's home was rejected because it was too close to a day care center, and his aunt's residence was rejected because she has grandchildren who regularly visit.

Because Gustafsen has no resources to pay for housing, he has no other options, the lawsuit notes. He cannot meet the requirements to live in an approved site, so he remains in prison; and he cannot apply for an end to his mandatory supervised release as long as he remains in prison.

The lawsuit says the result for Gustafsen and the other prisoners is "what amounts to a Kafkaesque nightmare."