The life sentences that Lee Boyd Malvo received for his role in the 2002 sniper shootings which occurred in Virginia were thrown out Friday by a federal judge, because Malvo was 17 at the time of the attacks.

The Supreme Court ruled in 2012 that mandatory life sentences without the possibility of parole were unconstitutional for juveniles, and in 2016 the court decided that ruling should be applied retroactively. And so even though Malvo entered pleas in Spotsylvania County, Va., and agreed to serve two life sentences without parole, in addition to being convicted by a jury and sentenced to two life sentences in Chesapeake, Va., U.S. District Court Judge Raymond A. Jackson vacated all four sentences and ordered resentencings.

The ruling does not apply to the six life sentences Malvo received in Maryland after he pleaded guilty to six murder charges there. His Maryland lawyers are appealing in both state and federal court on the same grounds, and a hearing is set for next month.

[Malvo, 10 years later: I was a monster]

The ruling also does not vacate Malvo’s convictions. Instead, the courts in Fairfax and Spotsylvania must resentence Malvo, on the new standards devised by the Supreme Court in 2012, and he could still receive life sentences again. But before that happens, the Virginia attorney general could appeal Jackson’s ruling, which would postpone any resentencing hearings.

Malvo, now 32, and John Allen Muhammad were both convicted of 10 murders committed in a three-week period in the Washington area, beginning with trials in Virginia in 2003. Muhammad was sentenced to death for the slaying in Prince William County of Dean H. Meyers, and he was executed in 2009.

Prosecutors sought the death penalty for Malvo as well, for the slaying in Fairfax County, Va., of Linda Franklin outside a Home Depot in the Falls Church area. But a jury in Chesapeake, where the trial was moved because of pretrial publicity, chose a life sentence for Malvo, and Fairfax Circuit Court Judge Jane Marum Roush imposed that sentence in March 2004.

Malvo’s lawyers, his original trial team of Craig Cooley and Michael Arif, argued that because the jury was given only two options — death or life without parole — that when they chose life, Roush’s sentence was mandatory. The Virginia attorney general responded that Roush could have suspended some of Malvo’s life term. Jackson rejected that argument.

In October 2004, Malvo entered Alford pleas to two more shootings in Spotsylvania County, Va.: the wounding of Caroline Seawell in Fredericksburg, Va., and the slaying of Kenneth Bridges at a gas station in Massaponax, Va. An Alford plea means a defendant does not admit guilt but acknowledges there is enough evidence to convict. Malvo then was found guilty and as part of a plea agreement was sentenced to two more life sentences without parole.

Virginia argued that Malvo waived his right to appeal when he entered his pleas. But Jackson ruled that Malvo didn’t waive that right because it didn’t exist in 2004, but must be acknowledged now.

[Malvo, teen in D.C. sniper case, challenges life-without-parole sentences]

The Supreme Court ruled in 2012, in Miller v. Alabama, that “sentencing a child to life without parole is excessive for all but ‘the rare juvenile offender whose crime reflects irreparable corruption.’” So in sentencing defendants 17 and younger, judges must now consider whether a juvenile’s crime reflects “irreparable corruption” or simply “the transient immaturity of youth,” Jackson wrote.

In Chesapeake, Roush did not consider those factors before imposing the jury’s death sentence, even though those factors were not legally in existence. Malvo’s entire trial was essentially a sentencing hearing, as Cooley and Arif told a life story of abuse and neglect by his mother, and brainwashing by Muhammad.

Similarly, the issues of irreparable corruption or immaturity were not considered in Spotsylvania even though Malvo entered pleas, Jackson wrote. “The Supreme Court has decided that the Miller rule is a substantive rule of constitutional law that is so fundamental that it requires retroactive application,” Jackson concluded.

“I’m not surprised at the ruling,” Cooley said Friday. “I think he [Jackson] just followed the way the Supreme Court cases were leading. I think that’s the appropriate resolution.”

Michael Kelly, a spokesman for the Virginia attorney general’s office, said Friday evening, “We are reviewing the decision and will do everything possible, including a possible appeal, to make sure this convicted mass murderer serves the life sentences that were originally imposed.”

Dan Morse contributed to this report.