A judge is scheduled to rule Wednesday on Minnesota's sex offender treatment program, and his decision could lead to freedom eventually for many residents who had felt little hope of ever being released.

Even before hearing testimony in February and March, federal Judge Donovan Frank wrote that the program was "clearly broken" and that "the interests of justice require substantial changes." He isn't expected to shut the program down, but could order significant changes.

The class-action lawsuit on behalf of more than 700 offenders argues the program is unconstitutional because nobody has ever been fully discharged from it — even those who could safely be freed or transferred to less-restrictive facilities.

The state says it has improved the program, including moving more patients through treatment and perhaps toward provisional release.