BOSTON, July 31 (Reuters) - A federal appeals court on Friday overturned Boston Marathon bomber Dzhokhar Tsarnaev's death sentence for helping carry out the 2013 attack, which killed three people and wounded more than 260 others.

Tsarnaev and his older brother set off a pair of homemade pressure-cooker bombs near the finish line of the world-renowned race, tearing through the packed crowd and causing many people to lose legs.

A three-judge panel of the 1st U.S. Circuit Court of Appeals upheld much of Tsarnaev's conviction but ordered a new trial over what sentence Tsarnaev should receive for the death penalty-eligible crimes he was convicted of.

U.S. Circuit Judge O. Rogeriee Thompson, writing for the court, said the trial judge "fell short" in conducting the jury selection process and screening jurors for potential bias following pretrial publicity surrounding the high-profile case.

Thompson said the pervasive news coverage of the bombings and their aftermath featured "bone-chilling" photos and videos of Tsarnaev, now 27, and his brother carrying backpacks at the marathon and of those injured and killed near its finish line.

Newsletter signup for email alerts

Thompson said the judge deemed jurors eligible who had "already formed an opinion that Dzhokhar was guilty - and he did so in large part because they answered 'yes' to the question whether they could decide this high-profile case based on the evidence."

Thompson stressed the ruling's limits. "Make no mistake: Dzhokhar will spend his remaining days locked up in prison, with the only matter remaining being whether he will die by execution," she said.

While all three judges agreed the death sentence should be overturned, U.S. Circuit Judge Juan Torruella said he believed Tsarnaev was also denied the right to a fair trial when the judge declined to let the case be tried outside of Boston.

David Patton, Tsarnaev's lawyer, said prosecutors must now decide "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."

U.S. Attorney Andrew Lelling's spokeswoman said his office is reviewing the decision. Prosecutors could ask the full appeals court to reconsider the ruling or appeal to the U.S. Supreme Court.

Speaking at an event with law enforcement in Tampa, Florida, President Donald Trump referred to Tsarnaev as an "animal."

"They just sent this conviction for the death penalty back to the lower courts so they’ll argue about that for a long time," Trump said. "It's ridiculous."

HOUSE-TO-HOUSE MANHUNT

Tsarnaev is being held at the United States' "Supermax" prison in Florence, Colorado, a site so remote and well secured that it is nicknamed the "Alcatraz of the Rockies."

Tsarnaev and his older brother Tamerlan sparked five days of panic in Boston on April 15, 2013, when they detonated two homemade pressure cooker bombs at the marathon's finish line and then went into hiding.

Three nights later, as they attempted to flee the city, they sparked a new round of terror in Boston when they hijacked a car and shot dead Massachusetts Institute of Technology police officer Sean Collier. Tsarnaev's brother died later that night after a gunfight with police, which ended when Dzhokhar ran him over with a stolen car.

Police then locked down Boston and most surrounding communities for almost 24 hours, with heavily armed officers conducting house-to-house searches through the suburb of Watertown, where the surviving brother was found hiding in a dry-docked boat in a backyard.

A jury in 2015 found Tsarnaev guilty of all 30 counts he faced and later determined he deserved execution for a bomb he planted that killed 8-year-old Martin Richard and 23-year-old Chinese exchange student Lingzi Lu. Restaurant manager Krystle Campbell, 29, was also killed.

Bill and Denise Richard, whose son Martin was the youngest fatality in the attack, in a statement printed on the front page of the Boston Globe in 2015 had asked the U.S. Department of Justice to drop its pursuit of the death penalty, saying it would only prolong their pain.

On the day of his sentencing, Tsarnaev admitted his crimes.

"I am sorry for the lives I have taken, for the suffering that I have caused you, for the damage I have done, irreparable damage," said Tsarnaev. "In case there is any doubt, I am guilty of this attack, along with my brother." (Reporting by Nate Raymond; Editing by Scott Malone, Leslie Adler, Jonathan Oatis and Daniel Wallis)