MINNEAPOLIS (AP) - A federal judge has ruled that Minnesota's sex offender treatment program is unconstitutional, but has deferred any immediate action to await further proceedings on a remedy.

U.S. District Judge Donovan Frank largely sided with the more than 700 residents who were civilly committed to the Minnesota Sex Offender Program after they completed their prison sentences.

Their lawyers argued during a nearly six-week bench trial in February and March that the program is unconstitutional because nobody has ever been fully discharged from it, even those thought to be at low risk of committing new crimes.

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

Frank said proceedings to determine a remedy will begin in August.