DETROIT (AP) — The Supreme Court ruling that banned states from imposing mandatory life sentences on juveniles offers an unexpected chance at freedom to more than 2,000 inmates who had almost no hope they would ever get out.

In more than two dozen states, lawyers can now ask for new sentences. And judges will have discretion to look beyond the crime at other factors such as a prisoner’s age at the time of the offense, the person’s background and perhaps evidence that an inmate has changed while incarcerated.

“The sentence may still be the same,” said Lawrence Wojcik, a Chicago lawyer who co-chairs the juvenile justice committee of the American Bar Association. “But even a sentence with a chance for parole gives hope.”

Virtually all of the sentences in question are for murder. When Henry Hill was an illiterate 16-year-old, he was linked to a killing at a park in Saginaw County and convicted of aiding and abetting murder.

Hill had a gun, but he was never accused of firing the fatal shot. Nonetheless, the sentence was automatic: life without parole. He’s spent the last 32 years in Michigan prisons.

“I was a 16-year-old with a mentality of a 9-year-old. I didn’t understand what life without parole even meant,” Hill, now 48, said Tuesday in a phone interview.

He heard about the Supreme Court decision while watching TV news in his cell.

“I got up hollering and rejoicing and praising God,” said Hill, who would like to renovate homes and be a mentor to children if he’s released. “The last three or four years, they always put young guys in with me.”

The ruling also alarmed families of crime victims. Jessica Cooper, prosecutor in Oakland County, Mich., said her office has been taking calls from “distressed” relatives.

The Michigan Corrections Department said 364 inmates are serving mandatory life sentences for crimes they committed before turning 18. The prisoners now range in age from 16 to 67.

In Monday’s 5-4 decision, the high court said life without parole for juveniles violates the Constitution’s ban against cruel and unusual punishment. More than 2,000 people are in U.S. prisons under such a sentence, according to facts agreed on by attorneys for both sides of the case.

It’s possible that some inmates will win immediate release. Judges could also impose new sentences carrying a specific number of years and a parole review. Some inmates could still be kept locked up for life.

“Judges have options,” said Deborah LaBelle, a lawyer in Ann Arbor, Mich. “The Supreme Court said to look at juveniles individually: their age, family background, peer pressures, home environments.”

LaBelle said she took a phone call from 34-year-old inmate Kevin Boyd, who was 16 when his mother killed his father. Boyd had given her the keys to his father’s apartment, was aware of her threats and was convicted of murder.

After hearing of the court’s decision, Boyd told LaBelle that he slept “with hope on my pillow for the first time in 15 years.”

Back in 1996, Saulo Montalvo was a 16-year-old getaway driver in a fatal store robbery in Grand Rapids. He never stepped into the store but was convicted of murder and sent away for life.

“My mom and dad had gotten divorced, and I thought I had something to do with it,” he said of his teen years. “I placed this burden on myself and began to act out. I gravitated toward people who were into minor crimes, drinking and smoking marijuana, and sought their acceptance. ... I was so broken by what I had done.”

He said the victim’s family has long forgiven him. And if released, Montalvo said, he could “be a benefit to the society I left behind.”

The judge who sentenced him, Dennis Kolenda, didn’t like the punishment but had to follow the law.

“A community that’s got a soul has to recognize children are different, and we need to treat them as different,” said Kolenda, who is now retired. “Some are incredibly dangerous, but we never know with kids how they're going to develop.”

Michigan Attorney General Bill Schuette, who supported the state’s life without parole law for juveniles, said crime victims won’t be forgotten during the next round of court hearings.

“Every case has its unique set of facts,” Schuette said. “We’re going to make sure the truth is accurate.”