A federal appeals court has set aside the death penalty for the man convicted of planting a pair of bombs that killed three people and maimed or injured dozens of others at the 2013 Boston Marathon.

The U.S. Court of Appeals for the First Circuit found that a lower court judge did not adequately explore the impact of the extensive pretrial publicity on the jurors who recommended the death sentence for Dzhokhar Tsarnaev. The case will go back to the lower court for additional hearings, but the court’s overturning of the death sentences does not mean Tsarnaev will have an opportunity to get out of prison.

“Just to be crystal clear,” the court wrote, “Dzhokhar will remain confined to prison for the rest of his life, with the only question remaining being whether the government will end his life by executing him.”

Jurors found that Tsarnaev and his older brother Tamerlan — who died after a firefight with police in the bombing’s aftermath — carried out the bombings at the marathon’s finish line, turning one of Boston’s most celebrated annual events into the worst domestic terrorist attack since Sept. 11, 2001. The First Circuit judges wrote that the brothers were “radical jihadists bent on killing Americans” and said “the duo caused battlefield-like carnage.”

Tsarnaev’s federal defenders said in a statement Friday that they were “grateful for the Court’s straightforward and fair decision.”

“If the government wishes to put someone to death, it must make its case to a fairly selected jury that is provided all relevant information. The court rightly acknowledges, as do we, the extraordinary harm done to the victims of the bombing. It is now up to the government to determine whether to put the victims and Boston through a second trial, or to allow closure to this terrible tragedy by permitting a sentence of life without the possibility of release,” the lawyers said.

A spokeswoman for the U.S. attorney’s office in Boston said the office is reviewing the opinion and declined further comment.

Carmen M. Ortiz, the U.S. attorney whose office prosecuted Tsarnaev, called the ruling “unfortunate and disappointing.” While the media attention was extensive in Boston and worldwide, she said she felt the jury selection was fair. And she said the jurors held Tsarnaev accountable only for his specific crimes, and recommended the death sentence based on the two people killed by the bomb he planted.

“The government always seeks to have a fair and impartial jury, and goes through a fair process and a very thorough process, because you want to avoid something like this,” said Ortiz, who left the U.S. attorney’s office in 2017 and is now in private practice in Boston, during a telephone interview. “The most disappointing piece of this is that it brings tremendous pain and suffering for victims and victims’ families, and survivors of Tsarnaev’s crimes. My heart goes out to them.”

The explosions of the homemade bombs sent shrapnel flying into the crowd, killing 8-year-old Martin Richard; graduate student Lingzi Lu, 23; and Krystle Campbell, a 29-year-old restaurant manager. Many others were grievously wounded, including several who lost limbs. The brothers later ambushed and fatally shot an MIT police officer, Sean Collier.

Tsarnaev, who was 19 at the time of the bombing and is now 27 and imprisoned in Colorado, was convicted and sentenced to death in 2015 for his role in the bombing.

When he was formally sentenced, Tsarnaev broke his extended silence by apologizing to victims and survivors of the attack, saying: “I am sorry for the lives I have taken and suffering I have caused you and the damage I have done.”

Before he spoke, relatives of victims killed in the attack and its aftermath assailed him as a remorseless coward.

Tsarnaev’s attorneys in the case, seeking to avoid a death sentence, argued that his older brother, Tamerlan, orchestrated the attack and guided his younger sibling. Prosecutors instead described the brothers as partners who worked together to carry out a “cruel” attack.

Jurors found Tsarnaev guilty on all 30 counts, then came back and agreed he should be sentenced to death.

Ever since he was sentenced, when or if Tsarnaev would ever see the inside of an execution chamber had remained a question likely to stretch across many years, given the appeals expected to play out in the case.

Federal death sentences are a rarity and executions are even less common. The federal death penalty statute was reinstated in 1988 and expanded in 1994, and until this year, the government had carried out three executions. Most executions are carried out by states, and the number of executions has been declining in recent years.

The Trump administration has recently pushed back against that trend, scheduling and carrying out federal executions again as part of a push to restart federal capital punishment.

In mid-July, the Justice Department carried out three federal executions in four days, matching the total carried out by the United States government during the previous three decades. The department also has scheduled two more federal executions for late August, and on Friday afternoon scheduled two more federal executions for September.