Boston Marathon bomber Dzhokhar Tsarnaev apologized in court Wednesday for "the suffering that I've caused" in the April 2013 attack that killed three people and wounded hundreds.

Tsarnaev said in a shaky voice that he was guilty and that he prays for the victims.

"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," he said, breaking more than two years of public silence.

"If there is any lingering doubt, let there be no more. I did it, along with my brother," Tsarnaev said, referring to the bombings carried out by him and older brother Tamerlan. "I ask Allah to have mercy on me, my brother and my family," he added, CNN reported.

When Tsarnaev was finished speaking, Judge George O'Toole formally sentenced him to die.

"What will be remembered is that you murdered and maimed innocent people, and that you did it willfully and intentionally. You did it on purpose," O'Toole said, adding "I sentence you to the penalty of death by execution."

A jury decided six weeks ago that Tsarnaev should be executed for the 2013 terror attack that rocked Boston and the nation. The only suspense Wednesday was whether Tsarnaev, now 21, would apologize, explain why he committed the crimes or speak at all before Judge George O'Toole. Tsarnaev did not testify at his trial.

Earlier, dozens of survivors and family members of Tsarnaev's victims took turns testifying at the hearing, although Tsarnaev's fate had already been determined.

Bill Richard, the father of 8-year-old Martin, said Tsarnaev could have refused to participate in the horrific attack and could have stopped his brother, Tamerlan Tsarnaev, as well.

"He could have changed his mind the morning of April 15, 2013, walked away with a minimal sense of humanity and reported to authorities that his brother intended to hurt others," Richard said. Instead, he added, "He chose hate. He chose destruction. He chose death. This is all on him."

Patricia Campbell, the mother of a woman killed in the bombings, was the first person to give a victim impact statement. She looked directly at her daughter's killer when she spoke.

"What you did to my daughter is disgusting," said Campbell, the mother of 29-year-old Krystle Campbell. "I don't know what to say to you. I think the jury did the right thing."

The trial and sentencing brought back painful memories, with jurors viewing recordings of the twin blasts as pressure-cooker bombs exploded in the crowd near the finish line. The jury watched the mayhem that ensued as spectators and emergency personnel scrambled to aid the wounded.

The trial also featured testimony from the families of the slain, including Richard and Campbell; an aunt of Lingzi Lu, 23; and the brother of Massachusetts Institute of Technology police officer Sean Collier, 26.

Collier was fatally shot by the Tsarnaevs three days after the bombing. Tamerlan Tsarnaev, 26, died following a gunfight with police after Collier's shooting. Dzhokhar was captured a short time later.

The jurors weighed 12 aggravating factors against 21 mitigating factors in determining Dzhokhar Tsarnaev's sentence. They were charged to consider the suffering Tsarnaev caused, his intent, his character and even whether or not he was remorseful.

The jurors rejected defense efforts to depict Tamerlan as the mastermind of the attack, while the younger man was only following a charismatic, domineering sibling. Tsarnaev was convicted on all 30 counts and sentenced to death on six of them.

The jury found him responsible for killing four people, seriously maiming 17 and injuring hundreds more.

Massachusetts outlawed the death penalty in 1984, and no one has been executed in the state since 1947. But Tsarnaev was tried in federal court, where the death penalty remains an option.