Deputies escort Lee Boyd Malvo into court Oct. 22, 2003, during his murder trial in Virginia Beach, Va. (Pool/Getty Images)

A federal appeals court on Thursday agreed to throw out the four life sentences that Lee Boyd Malvo received for his role in the 2002 Beltway sniper shootings that occurred in Virginia when he was 17.

The unanimous ruling from the three-judge panel cites a Supreme Court decision in 2012 that mandatory life sentences without the possibility of parole are unconstitutional for juveniles. The court made that decision retroactive in 2016.

Barring an appeal, Malvo would face new sentencing hearings in two jurisdictions in Virginia. He pleaded guilty in Spotsylvania County and agreed to two life sentences without parole, and was convicted by a jury in Chesapeake and given the same punishment. The three-judge appellate panel vacated all four sentences; the convictions still stand.

“We’re pleased with the decision, of course, and not just for Lee Malvo, but for all juveniles that are in a similar situation,” said one of his attorneys, Craig Stover Cooley. Under Virginia law, the jury in Chesapeake had only two possible sentences to weigh for the capital murder convictions: death or life in prison without parole.

If the jury had other options, Cooley said, “I think at the time we would have had a sentence of less than life without parole.”

Virginia’s attorney general can ask the entire U.S. Court of Appeals for the 4th Circuit to rehear the case, appeal to the U.S. Supreme Court or move forward with new sentencing hearings. In a statement, a spokeswoman for the attorney general said lawyers plan to “review the decision closely and decide how best to proceed in a way that ensures this convicted mass murderer faces justice for his heinous crimes.”

Malvo, 33, and John Allen Muhammad also killed six people in the Maryland suburbs of Washington during a three-week period that terrorized the region. Muhammad was executed in Virginia in 2009. Malvo is being held at Red Onion State Prison in Wise County, Va.

Thursday’s ruling does not apply to the six life sentences Malvo received in Maryland after he pleaded guilty to six murder charges in that state. In August, a judge in Montgomery County upheld the sentences, concluding that the judge was not required by law to impose a sentence of life without parole.

“We stand by our case and how it has played out over time,” John McCarthy, state’s attorney for Montgomery County, said Thursday in a statement.

In the ruling in Virginia, the three judges on the 4th Circuit Court of Appeals — Paul V. Niemeyer, Robert B. King and Albert Diaz — wrote that their conclusions were made “not with any satisfaction but to sustain the law.”

The judges made clear that the shootings “were the most heinous, random acts of premeditated violence conceivable, destroying lives and families and terrorizing the entire Washington, D.C., metropolitan area for over six weeks, instilling mortal fear daily in the citizens of that community.”

The ruling said prosecutors sought penalties that at the time were “legally imposed with arguments that are not without substantial force.”

But they said the law is clear. “Malvo was 17 years old when he committed the murders, and he now has the retroactive benefit of new constitutional rules that treat juveniles differently for sentencing.” The judges concluded: “As for Malvo, who knows but God how he will bear the future.”

In the case heard in Chesapeake, prosecutors had sought the death penalty for Malvo for shooting FBI analyst Linda Franklin outside a Fairfax County Home Depot store. The proceedings were held in the Hampton Roads area because of pretrial publicity.

The Virginia Attorney General’s Office argued that the Supreme Court ruling applies only to mandatory sentences and that the judge in Chesapeake had a choice to suspend some of Malvo’s life term. Malvo’s attorneys, Cooley and Michael Arif, argued that the sentence imposed was mandatory because the jury was given only two options. The appellate court agreed with Malvo’s attorneys.

The state argued that because Malvo entered Alford pleas to two more shootings in Spotsylvania County, he had waived his right to appeal. In an Alford plea, a defendant acknowledges that enough evidence exists for a conviction. A judge then found him guilty. The appellate judges ruled that Malvo could not have waived a right that didn’t then exist.

The Supreme Court ruling stems from a 2012 case, Miller v. Alabama, in which the justices found that “sentencing a child to life without parole is excessive for all but ‘the rare juvenile offender whose crime reflects irreparable corruption.’ ” 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.”

Those issues were not discussed at Malvo’s sentencing in Virginia, and the appellate court left open the possibility that prosecutors could raise them at a new sentencing hearing to try again to obtain a sentence of life without parole

Cooley said he believes his client will be able to show “transient immaturity” given prior abuse and neglect by his mother and his argument that he was brainwashed by Muhammad. In Chesapeake, Cooley said he thinks a new jury would be convened for a new sentencing. He said they would be brought up to speed on the basic facts of the case.

Cooley said he plans to not only recount Malvo’s difficult past, but show how his client has changed in prison, and has been writing poetry and drawing sketches.