In 1996, legislators passed a law requiring that 16- and 17-year-old defendants be automatically transferred to adult court when charged with certain offenses.

The 6-1 decision stems from the case of 16-year-old Matthew Aalim, who faced armed robbery charges in Montgomery County in 2013. Aalim’s case was sent to adult court, which denied his request to return the case to juvenile court. As part of a plea deal, Aalim pleaded no contest and was sentenced to concurrent four-year terms.

Montgomery County Prosecutor Matt Heck said this was an “important decision” by the court.

“This ruling only applies to certain juveniles who have committed the most serious crimes such as murder or rape, are of a certain age, or were previously convicted of a most serious offense,” Heck said. “The juvenile justice system is ill equipped to effectively rehabilitate those defendants. Furthermore, the juvenile system can only incarcerate defendants until age 21, when they must be released. In the adult system they can be incarcerated much longer, and once released they can be kept under the jurisdiction and control of the Adult Parole Authority.”

Related: Ohio Supreme Court: backpack searches fair game on school property

In December 2016, shortly before her retirement from the supreme court, Justice Judith Lanzinger authored a court decision that said mandatory bindover laws violated the due process rights of juveniles. The Montgomery County Prosecutor’s office asked that the decision be reconsidered.

Ohio, which established juvenile courts in 1937, added a requirement in 1969 that “amenability” hearing to determine if the juvenile is a good candidate for rehabilitation.

Related: Ohio Supreme Court to decide if those with HIV have to disclose it

State law says that older juveniles who commit murder, are repeat felony offenders or commit felonies with a firearm are under the jurisdiction of adult court.

“Ohio’s mandatory transfer statute creates a system in which a judge has no right to even inquire into a juvenile’s potential for rehabilitation, let alone weigh it,” O’Connor wrote in her dissent. “Without allowing a judge to conduct any inquiry beyond probable cause or age, there is significant risk of turning a delinquent capable of rehabilitation into a lifelong criminal.”

Aalim, now 19, is serving his sentence in Lebanon Correctional Institution, an adult prison.