BOSTON — Moments before a judge sentenced him to death, Boston Marathon bomber Dzhokhar Tsarnaev broke more than two years of silence Wednesday and apologized to the victims and their loved ones for the first time. “I pray for your relief, for your healing,” he said.

“I am sorry for the lives that I’ve taken, for the suffering that I’ve caused you, for the damage that I’ve done – irreparable damage,” the 21-year-old former college student, speaking haltingly in his Russian accent, said after rising to his feet in the hushed federal courtroom.

After Tsarnaev spoke his piece, U.S. District Judge George O’Toole Jr. quoted Shakespeare’s line “The evil that men do lives after them. The good is often interred with their bones.”

“So it will be for Dzhokhar Tsarnaev,” the judge said, telling Tsarnaev that no one will remember that his teachers were fond of him, that his friends found him fun to be with or that he showed compassion to disabled people. What will be remembered is that you murdered and maimed innocent people and that you did it willfully and intentionally,” O’Toole said.

Tsarnaev looked down and rubbed his hands together as the judge pronounced his fate: execution, the punishment decided on by the jury last month.

The apology came after Tsarnaev listened impassively for about three hours as a procession of 24 victims and survivors lashed out at him for his “cowardly” and “disgusting” acts and urged him to show some remorse at long last.

Tsarnaev assured the victims he was paying attention. “All those who got up on that witness stand and that podium relayed to us, to me – I was listening – the suffering that was and the hardship that still is, with strength, with patience, with dignity,” he said.

The outcome of the proceedings was never in doubt: The judge was required under law to impose the jury’s death sentence for the April 15, 2013, attack.

The only real suspense was whether Tsarnaev would say anything when offered the chance to speak. And if so, would he show remorse? Or would he make a political statement and seek to justify the attack?

His apology was a five-minute address peppered with religious references and praise of Allah. He asked that Allah have mercy upon him and his dead brother and partner in crime, Tamerlan, but he made no mention of the motive for the bombing.

He paused several times as if struggling to maintain his composure. He faced the judge while speaking but addressed himself to the victims.

Tsarnaev admitted he carried out the bombing – “If there’s any lingering doubt about that, let there be no more” – and added: “I did do it along with my brother.”

Outside court, some bombing survivors said they doubted Tsarnaev’s sincerity.

“It really does not change anything for me,” Scott Weisberg said.

But another survivor, Henry Borgard, said: “I was actually really happy that he made the statement. I have forgiven him. I have come to a place of peace and I genuinely hope that he does as well.”

U.S. Attorney Carmen Otiz said “He didn’t renounce terrorism, he didn’t renounce violent extremism.”

Tsarnaev will probably be sent to the death row unit at the federal penitentiary in Terre Haute, Indiana, where Oklahoma City bomber Timothy McVeigh was executed. It could take years or even decades for his appeals to work their way through the courts.

In May, the jury condemned the former college student to die for joining his older brother in setting off the two pressure-cooker bombs near the finish line and in killing an MIT police officer as they fled. Tamerlan, 26, was killed during the getaway.

“He can’t possibly have had a soul to do such a horrible thing,” said Karen Rand McWatters, who lost a leg in the attack and whose best friend, 29-year-old Krystle Campbell, was killed.

Campbell’s mother, Patricia Campbell, looked across the room at Tsarnaev, seated about 20 feet away, and spoke directly to him.

“What you did to my daughter is disgusting,” she said. “I don’t know what to say to you. I think the jury did the right thing.”

Rebekah Gregory, a Texas woman who lost a leg in the bombing, defiantly told Tsarnaev she is not his victim.

“While your intention was to destroy America, what you have really accomplished is actually quite the opposite – you’ve unified us,” she said, staring directly at Tsarnaev as he looked down.

“We are Boston strong, we are America strong, and choosing to mess with us was a terrible idea. So how’s that for your VICTIM impact statement?”

Bill Richard, whose 8-year-old son Martin was the youngest person killed in the bombing, noted that his family would have preferred that Tsarnaev receive a life sentence so that he could contemplate his crimes.

Richard said his family has chosen love, kindness and peace, adding: “That is what makes us different than him.”