Updated

The Supreme Court ruled Monday that people serving life terms for murders they committed as teenagers must have a chance to seek their freedom, a decision that could affect more than 1,000 inmates.

The justices voted 6-3 to extend a ruling from 2012 that struck down automatic life terms with no chance of parole for teenage killers. Now, even those who were convicted long ago must be considered for parole or given a new sentence.

The court ruled in the case of Henry Montgomery, who has been in prison more than 50 years, since he killed a sheriff's deputy as a 17-year-old in Baton Rouge, Louisiana, in 1963.

Justice Anthony Kennedy, writing the majority opinion, said that "prisoners like Montgomery must be given the opportunity to show their crime did not reflect irreparable corruption; and if it did not, their hope for some years of life outside prison walls must be restored."

Kennedy said states do not have to go so far as to resentence people serving life terms. Instead, the states can offer parole hearings with no guarantee of release.

Louisiana, Michigan and Pennsylvania have more than 1,000 people serving life sentences for murders they committed before their 18th birthday, according to Michigan's Supreme Court filing in Montgomery's case. They are among the few states that have refused to extend the Supreme Court's ruling from 2012.

Monday's decision does not expressly foreclose judges from sentencing teenagers to a lifetime in prison. But the Supreme Court has previously said such sentences should be rare, and only for the most heinous crimes.

In dissent, Justice Antonin Scalia said the ruling "is just a devious way of eliminating life without parole for juvenile offenders." Justices Samuel Alito and Clarence Thomas joined Scalia's dissent.

Four years ago, the justices struck down automatic life sentences with no chance of release for teenage killers, but did not answer then whether the ruling in Miller v. Alabama should be extended retroactively to Montgomery and hundreds of other inmates whose convictions are final.

In the 5-4 decision in 2012, Justice Elena Kagan wrote for the majority that judges weighing prison terms for young offenders must take into account "the mitigating qualities of youth," among them immaturity and the failure to understand fully the consequences of their actions.

Chief Justice John Roberts dissented from the 2012 decision barring automatic life sentences for young killers, but he joined the majority on Monday along with Justices Stephen Breyer, Ruth Bader Ginsburg, Sonia Sotomayor and Kagan.

Through legislative action or court rulings, 18 states have allowed inmates like Montgomery to be given new prison sentences or to ask for their release, according to The Sentencing Project. Louisiana is among seven states that had declined to apply the Supreme Court ruling retroactively.

The outcome in Montgomery's case is the latest in a line of Supreme Court decisions that have limited states in the way they punish juveniles. Kennedy also wrote the 2005 decision that outlawed the death penalty for juveniles. The justices also have barred life without parole sentences for people convicted of crimes other than murder that were committed before they turned 18.

The court often applies groundbreaking decisions in criminal law retroactively. Kennedy rejected Louisiana's argument that the Alabama case should not be viewed as quite that important because the court only declared unconstitutional such sentences where judges lack discretion, and specifically did not bar judges from sentencing juveniles to life in prison after considering individual circumstances.

Montgomery's case highlights some of the problems that inmate advocates say plague the criminal justice system generally. Montgomery is African-American, and he was tried for killing the white deputy in a time of racial tension and reported cross burnings in Baton Rouge.

The State Times newspaper of Baton Rouge ran a front-page headline after Montgomery's arrest: "Negro Held in Deputy's Murder Here." The story noted that "more than 60 Negroes were detained" in a parish-wide manhunt.

The Louisiana Supreme Court threw out Montgomery's first conviction because he did not get a fair trial. He was convicted and sentenced to life after a second trial.

The case is Montgomery v. Louisiana, 14-280.