A man who was 17 when he was sentenced to life in prison without parole in the 1999 killing of an Old Colorado City ice cream store worker bowed his head and sobbed Thursday as a judge reduced his sentence.

Andrew Michael Medina, now 34, was resentenced to 37 years in prison, meaning he will be released in roughly 15 years.

He becomes the 22nd Colorado offender to benefit from a national sea change in how youthful killers are punished for their crimes, according to his attorneys.

The reduced penalty stems in part from a judge’s finding that Medina turned his life around, becoming a “model prisoner” in the years after he fatally shot Kristopher Lohrmeyer during an attempted carjacking in west Colorado Springs when Medina was 15.

“The evidence is clear the defendant has essentially self-rehabilitated,” Senior District Judge John N. McMullen said at a hearing in 4th Judicial District Court, as Medina, seated at a defense table, rested his forehead on his cuffed hands and cried.

The ruling came at the conclusion of two-day hearing at which members of the Lohrmeyer family recounted the suffocating toll of the boy’s murder at age 17. Prosecutors argued that Medina “earned” his life term by his actions.

“It’s what he deserves,” Jennifer Viehman said in asking McMullen to impose a harsher alternative penalty: life in prison with the chance of parole after 40 years.

She described a teenager on a “collision course” with violence, citing his back-to-back arrests for car theft in the lead-up to the killing, including an incident where he threatened an uncle whose car he took.

The new sentence capped Medina’s seven-year push for clemency in the wake of a 2012 U.S. Supreme Court ruling, Miller v. Alabama, that found life sentences without the chance of parole for juvenile offenders were “cruel and unusual punishment,” rendering them unconstitutional.

A follow-up U.S. Supreme Court ruling in 2016, Montgomery v. Louisiana, made the Miller decision retroactive, effectively overturning Medina’s life sentence.

Medina petitioned for a reduced sentence under a controversial sentencing scheme adopted in 2016 by the Colorado Legislature.

The new law — applying to juveniles sentenced to life without parole between 1990 and 2006 — required resentencing for most to life with the chance of parole after 40 years.

But a handful of juveniles — those convicted of first-degree murder under the felony-murder rule — were offered the possibility of a 30 to 50 year sentence if they could prove “extraordinary mitigating circumstances.” Felony murder applies to anyone who participated in a felony that resulted in someone’s death, such as a getaway driver for a deadly robbery.

In opposing clemency, Viehman pointed out that Medina was the shooter, not the getaway driver, even if he wasn’t convicted of acting with intent or deliberation.

“This was never supposed to apply to him,” she complained to the judge.

Medina and two other teens armed themselves and decided to stake out a darkened parking lot at the Colorado City Creamery on West Colorado Avenue, intending to carjack the owner of a parked vehicle.

When Lohrmeyer left work and got into his car, Medina fired a round that hit him in the back of the head, killing him.

In petitioning for mercy, Medina’s attorneys cited the teenager’s turbulent home life in arguing he had diminished culpability.

Defense witnesses described beatings at the hands of Medina’s father, an alcoholic who introduced his son to drinking at a young age, and spoke about how the family’s more than two dozen moves in 15 years upended his schooling. Although prosecutors pointed out a lack of corroborating police reports, the judge said evidence of abuse was persuasive.

His upbringing was “simply chaotic,” McMullen said, resulting in immaturity, impulsiveness, and lack of judgment and appreciation for consequences.

After his imprisonment at age 17, Medina joined a prison gang and endured severe punishment for gang-related disruptions, including spending eight years in administrative segregation, commonly known as solitary confinement.

The practice, which kept him confined to a cell around the clock except for an hour a day, five days a week, has since been abolished by the state Department of Corrections.

Even before the 2012 Supreme Court decision, Medina had resolved to quit gang life, though it took him several years to finally cut ties.

He earned his GED and enrolled in college correspondence courses, establishing a six-year record as a “model prisoner” who mentors fellow inmates, the judge said, citing testimony by at least three state prisons employees who spoke on Medina’s behalf.

By the judge’s calculations, Medina will be kept in custody until he is roughly 50 years old, an estimate that went unchallenged by the defense and prosecution. One of Medina’s attorneys, Nicole Mooney of Denver, said he isn’t eligible for early parole under the 2016 sentencing changes.

Medina’s resentencing was in limbo for months as the Colorado courts took up challenges to the new sentencing laws led by prosecutors.

The dispute was resolved last September, when the Colorado Supreme Court ruled that the special sentencing for felony murder convictions was appropriate.

Of the 22 inmates, including Medina, resentenced in the wake of the Supreme Court ruling, at least two have been released from prison and 10 have received sentences in the 30- to 50-year range, according to a defense court filing.

The sentence means that Medina would be released around the same time as his co-defendants, Michael Brown and Derek Miller, the judge said. McMullen is a retired Denver District judge who serves as a part-time substitute where needed.

In addressing court on Wednesday, Medina opened and closed his remarks with an apology to the Lohrmeyer family, saying he’s no longer an immature 15-year-old but a “humbled man who truly realizes how precious life is.”

He asked for forgiveness, but said he understands if it doesn’t come.

“The Lohrmeyer family will forever be in my prayers,” he said. “I will live with this sorrow for the rest of my life.”

His comments in court were reminiscent of the remorse he expressed for more than a decade, said Nancy Grandys-Jones, a Denver woman who testified on his behalf. She told the court she struck up a pen-pal friendship with Medina beginning in 2006, after he wrote her a thank-you note for donating to a prison educational program.

She and her late husband became convinced of his sorrow and his conviction to make something positive of his life, even if he died in prison.

They didn’t lose sight of the pain he caused, and Medina hasn’t either, she said Thursday in reaction to the new sentence.

“I think his statement was powerful in speaking to the pain and the loss that will never be erased,” she said.