Minnesota is an outlier on solitary confinement, as documented in a series of stories published last week by the Star Tribune. It is a situation that has gone on too long, and one that must change, both for the sake of inmates subjected to overly long confinements and for the public that must deal with them when they get out.

An exhaustive examination of a decade’s worth of documents by Star Tribune reporter Andy Mannix shows a prison system that relies too heavily on solitary confinement for infractions, with the worst inmates “stacking” penalties that extend their stay in restrictive housing, sometimes for years. Studies of other prisons have shown that the use of solitary confinement can be cut without jeopardizing safety. Federal prisons have cut their use 25 percent since 2012 without compromising safety.

Minnesota is among the minority of states with no laws on solitary confinement. That should end when the Legislature reconvenes. Minnesota should enact some legal parameters to this practice, which some human-rights organizations consider akin to torture when confinement is prolonged. Solitary confinement has been shown to alter brain function after as little as two weeks. Long periods without social interaction or human touch can induce psychosis and other mental problems.

It can be hard to muster sympathy for violent offenders. But remember that 95 percent of them will be back among society at some point. They are not owed luxuries, but a safe environment that attempts to mend whatever is broken in them — or at least not worsen it — will benefit all.

Shockingly, Minnesota holds some inmates in solitary confinement right up until their release, when they are turned loose on an unsuspecting public. That was the case for 71 inmates last year. Corrections Commissioner Tom Roy told an editorial writer that he is concerned about safety, and “some prisoners are dangerous until the day they are released.” That is undoubtedly true, but they will be more so if they have not been reintroduced to social interaction before leaving prison. And while staff and inmate safety is a consideration, so is that of the public. Gov. Mark Dayton and legislators should follow the lead of the federal Bureau of Prisons and end the practice of continuing solitary confinement until release. Dayton said he is troubled by that practice, as well as by isolated confinement that lasts for years. “That is barbaric,” he said, rightly pledging to give reforms “the highest priority.”

Roy said his agency has been working on reforms that would shorten stays in solitary and create alternatives, but they require more intensive supervision and settings than what prisons now can offer. Legislators should take a close look at the funding needed.

We do not underestimate the difficulty of the Corrections Department’s task. As Roy puts it, “We’re the end of the road for all the system failures. When they have nowhere to go, they end up with us.”

But Minnesota is already under fire for its treatment of sex offenders. Let’s not wait until the costs of a lawsuit over solitary confinement are added to the cost of changes that clearly are needed.