A proposal that would make it more difficult to release convicted sex offenders and people with mental illness is gaining new momentum at the Minnesota Capitol, as the state faces growing legal pressure to free some patients from its embattled sex offender program.

The proposal comes in direct response to a court decision earlier this year that permitted the full discharge of a 51-year-old sex offender, Kirk A. Fugelseth, who has admitted to molesting more than 30 boys and girls and who was confined to the Minnesota Sex Offender Program (MSOP).

"It is simply unbelievable that Minnesota's safety has been put in jeopardy by the courts," Sen. Warren Limmer, the measure's sponsor, said Monday, shortly before the Senate overwhelmingly approved the proposal. "This is not a population that should be released quickly and in one fell swoop."

A state Court of Appeals panel ruled in January that Fugelseth no longer requires inpatient treatment or supervision for a sexual disorder, and in an unusual decision, approved his release without any conditions. The decision was upheld by the Minnesota Supreme Court earlier in April. Fugelseth is only the second person ever to be fully released from the MSOP in its 24-year history.

The bill from Limmer, a Republican from Maple Grove, would establish a higher standard for sex offenders and people committed as mentally ill and dangerous who are seeking an unconditional release.

There are about 140 civilly committed sex offenders, and another 300 people committed as mentally ill and dangerous, who could petition the courts for full and unconditional discharge based on the recent court ruling, state officials said. This includes 21 sex offenders who have been approved for conditional release from the MSOP, but are currently living under strict surveillance in the community.

Acting Human Services Commissioner Chuck Johnson, who spoke in support of the measure at Monday's news conference, urged immediate action. Unless the law is changed, dangerous offenders could start being approved by the courts for unconditional release into the community within "days or weeks," he said.

Minnesota is one of 20 states that operate a civil commitment system for sex offenders, which allows the state to confine people indefinitely after they have completed their prison terms. The system has been criticized in recent years for locking up too many offenders for too long, and state judicial panels have been approving a record number for conditional release.

The state has been challenging some of these court rulings, arguing that the offenders still pose a risk to the public and should remain under strict state surveillance.

In Fugelseth's case, a state judicial panel determined that the state did not prove, by clear and convincing evidence, that he was in need of "inpatient treatment and supervision." The ruling reflected a strict interpretation of the current state statute governing discharges of sex offenders.

Fugelseth was convicted of abusing children in Oregon, Arizona and Minnesota in the 1990s, and was convicted in 2000 of possession of child pornography. He requested a full release from the MSOP in 2016. The move was unusual because most offenders first petition for a provisional discharge, which includes significant limits on their freedoms. The judicial panel approved his petition, concluding that he had completed his recommended treatment and had a low risk of reoffending.

"We believe the court was wrong," Limmer said.

The legislation would make it more difficult for offenders to be fully discharged by striking the single word, "inpatient," from current law. In effect, the state would only have to prove that offenders such as Fugelseth are in need of treatment and supervision of any type, inpatient or otherwise. The amended language affirms that offenders can remain under state supervision even after they have been released from a secure facility, and may require treatment for their sexual behavior.

The bill also sets a higher bar for discharge from facilities such as the Minnesota Security Hospital in St. Peter that treat people who are civilly committed as mentally ill and dangerous. The bill also stipulates that, to be fully discharged, such patients must no longer be a danger to themselves or others, or no longer in need of treatment for their mental illness. Last year, there were 4,175 cases in which Minnesotans were civilly committed as mentally ill, according to state court data.

"It makes sense from the point of view of public safety," said Eric Janus, professor at Mitchell Hamline School of Law and author of a book on sex offender laws. "Our commitment system was designed to be a gradual, step-down process. There needs to be a period of readjustment, to help the person return to a self-regulated life after being institutionalized."

Rep. Brian Johnson, R-Cambridge, introduced a companion bill in the House, which advanced through a committee hearing in March.