The Michigan Supreme Court on Wednesday significantly limited when handcuffs, shackles and other restraints can be used on young people when they appear in court.

The new court rule, which goes into effect Sept. 1, states that juveniles cannot be put in restraints unless a judge finds it is necessary for one of three reasons: to prevent physical harm to the young person or others; because the juvenile has a history of disruptive courtroom behavior; or there is a strong reason to believe the juvenile will flee the courtroom.

Michigan joins 31 other states and the District of Columbia in prohibiting or limiting the shackling of youth in courts through legislation or court rules, according to the National Juvenile Defender Center. In Michigan, judges will have to decide whether restraints are necessary before the young person enters the courtroom. The juvenile’s attorney must have the opportunity to be heard on the issue and judges must state on the record or in writing the facts supporting a decision to use restraints.

“Indiscriminate shackling of juveniles is a practice to be avoided when it does not jeopardize the safety of the courtroom,” Justice Megan Cavanagh wrote in support of the rule. “It has been shown that shackling causes unnecessary stress and is harmful to juveniles and their families because it causes shame and humiliation.”

Two of the court’s seven justices opposed the change. “Court security lapses can have tragic consequences,” Justice David Viviano wrote. He said he was concerned that the rule limits the factors a judge can consider when deciding whether to allow the use of restraints.

Michigan’s practice of shackling youth was highlighted in a ProPublica investigation last year about the case of Grace, a 15-year-old Black teenager from suburban Detroit who was placed in detention when she violated probation by not doing her online schoolwork during the pandemic. Grace, who was on probation for earlier charges of assault and theft, appeared at a court hearing in June 2020 with her wrists handcuffed together and her ankles shackled although there was no evidence she posed a physical or flight risk. She struggled to turn the pages of a statement she had written.

“The humiliation and trauma of shackling my child has harmful effects that we will never be able to forget or reconcile as humane and appropriate treatment,” Grace’s mother said Wednesday after learning about the new court rule. “This traumatic experience is the legacy of discrimination in America and is especially damaging to youth of color. It resembled unforgettable images of slaves on the auction block.”

The Michigan Court of Appeals ordered Grace’s release a year ago this week, less than three weeks after the ProPublica investigation. The Michigan Supreme Court proposed the rule on juvenile restraints late last year and held a public hearing in March before announcing its final decision Wednesday.

Jason Smith, executive director of the Michigan Center for Youth Justice, a nonprofit organization that advocates for juvenile justice reform, said the new rule will “allow youth to be treated fairly in courtroom proceedings and focus on the issues of the case and not labeling a young person as a criminal or offender.”

“The juvenile justice system is supposed to be rehabilitative, not punitive,” he said. “We have an opportunity to really shift the system in a positive way with reforms like this.”

Groups that supported limiting restraints included juvenile justice and disability rights advocates, the ACLU of Michigan, and the Michigan Psychological Association. The Oakland County family court, which heard Grace’s case, opposed the new rule, arguing that law enforcement should decide when a young person should be restrained. The Oakland County Sheriff’s Office also opposed the measure.

The change comes as Michigan officials have pledged to improve the way the state handles young offenders. Gov. Gretchen Whitmer, a Democrat, announced last month the creation of the Task Force on Juvenile Justice Reform and asked it to collect data from the state and its counties to better understand how Michigan treats juveniles who break the law, and to propose ways to reduce the number of young people in the system.

A ProPublica investigation last year found Michigan incarcerates young people for probation violations and noncriminal offenses more than almost any other state. The investigation brought to light systemic flaws in the state’s decentralized juvenile justice system and revealed that Michigan keeps such poor data that it can’t say how many juveniles it has in custody at any given time or why they have been detained.

Whitmer’s office announced the members of the task force last week. The group, chaired by Lt. Gov. Garlin Gilchrist, a Democrat, is expected to announce its findings and recommendations for legislative, funding and other policy changes by July 2022.