A lawyer for Boston Marathon bomber Dzhokhar Tsarnaev asked an appeals court to throw out his death sentence, arguing that pretrial publicity prejudiced the jurors who decided his fate.

The defense lawyer, Daniel Habib, made the case Thursday that the judge erred by holding the trial in a still-traumatized city where wall-to-wall news coverage and a sense of shared victimhood made it impossible to select an impartial jury.

"This case should not have been tried in Boston," Habib said.

Assistant U.S. Attorney William Glaser asserted that the pretrial publicity didn't taint the jury, leading to an exchange with the judges over the impact of statements made by elected officials and public figures like Boston Red Sox slugger David “Big Papi” Ortiz.

Boston bombing suspect Dzhokhar Tsarnaev. U.S. Attorney's Office in Boston / Reuters file

Five days after the bombing, Ortiz went to the Fenway Park mound prior to a game and proclaimed, "This is our (expletive) city."

When the subject of Ortiz's speech was brought up, Judge Juan Torruella, one of a trio hearing the arguments, mistakenly referred to the ball player as a public official before correcting himself.

"If he ran for office, he probably would be," Torruella said, laughing.

It was the lone moment of levity in a hearing that centered on the most traumatic event in Boston's recent past.

The bombing at the 2013 Boston Marathon killed three people and wounded more than 260 others.

Tsarnaev carried out the attack with his older brother, Tamerlan, who died three days later in a shootout with police.

Boston was put on a citywide lockdown as thousands of cops and National Guard troops searched for the younger Tsarnaev brother.

The manhunt ended four days after the bombing when police found a wounded Tsarnaev hiding in a tarp-covered boat in the backyard of a home in Watertown, Mass.

Tsarnaev was convicted and sentenced to death in 2015.

Tsarnaev, 26, was not present at Thursday's hearing. He's locked up at the most secure prison in the United States: the ADX Florence in Colorado, known as the Alcatraz of the Rockies.

In arguing that the jury pool was tainted, Tsarnaev's lawyer noted that two jurors had failed to disclose they had discussed the case on social media prior to joining the panel.

One juror went on Facebook to tag himself at the courthouse on the day of jury selection, leading a friend to urge him to "get on the jury" and send Tsarnaev to jail where "he will be taken care of."

The jury foreperson said she had not made any online comments prior to the trial, but Habib said she had in fact described Tsarnaev in a social media post as a "piece of garbage."

Before the trial got underway, Tsarnaev's lawyers identified the social media comments as reasons to disqualify the two jurors. But Judge George O'Toole rejected that argument and allowed the jurors to remain on the case, describing the defense claims as "speculative."

Legal experts say it will be at least several months before the appeals court judges issue their opinion and order.

The judges could affirm the guilty verdict and sentence, or they could find an error in the trial proceedings and either order a new trial or just a new penalty phase.

In response to a question by one of the judges, Habib said he'd leave it up to a judge to decide if it would be fair to hold a new trial in Boston if the verdict were to be tossed.

"Time heals some wounds," he said.