Minnesota Gov. Tim Walz signed into law Friday a sweeping series of reforms to the state's use of solitary confinement in prisons designed to better safeguard mental health for people in isolation.

In the ceremonial signing at the Capitol, Walz stood with mental health advocates, bill authors and a former prisoner who spent time in solitary as he hailed the bill as a bipartisan success that will help move Minnesota into the modern era of corrections.

"I want to thank you all for this," said Walz. "We're really proud to update this and move Minnesota forward when it comes to modernizing our corrections system and dealing with mental health issues."

Previously, Minnesota ranked among a minority of states with no laws on the books specifically addressing solitary confinement, an increasingly controversial punishment that can cause debilitating long-term mental health effects.

A 2016 Star Tribune investigation found inmates regularly spent long periods in solitary, sometimes for minor infractions and with no regard for mental illness. Over a 10-year period examined by the Star Tribune, more than 1,600 inmates in Minnesota were held in such isolation for at least six months; 437 spent a year or longer. Hundreds left prison directly from long-term segregation, often lacking the basic tools to transition back into society.

The new law mandates that people can no longer leave prison directly from solitary. Incarcerated people who are exhibiting signs of mental illness will go through psychological screening before entering solitary, which will determine if isolation is an appropriate course of punishment. Once in solitary, they will receive daily wellness checks. They will be able to earn back privileges — including the ability to transition back to the general population more quickly — through good behavior. The commissioner of corrections will review solitary stays lasting more than four months and will be notified every time someone is in segregation for more than 30 days.

Those standing with Walz as he signed the bill included Rep. Nick Zerwas, R-Elk River, who's led the charge for the reforms at the Capitol for the past three years. Sue Abderholden, executive director of Minnesota's National Alliance on Mental Illness, who also aggressively lobbied the bill along with her staff, was also present. Aside them was Randy Anderson, a former incarcerated person who now helps people acclimate to society after prison.