CHARLOTTESVILLE, Va. — An avowed white supremacist who deliberately drove his car into a crowd of counterprotesters, killing a young woman and injuring dozens, apologized to his victims Friday before being sentenced to life in prison on federal hate crime charges.

James Alex Fields Jr., of Maumee, Ohio, had pleaded guilty in March to 29 of 30 hate crimes in connection with the 2017 attack that killed Heather Heyer and injured more than two dozen others.

Prosecutors and Fields' lawyers agreed that federal sentencing guidelines called for a life sentence. But his attorneys asked U.S. District Judge Michael Urbanski to consider a sentence of "less than life," hoping he would take into account Fields' troubled childhood and mental health issues.

Just before Urbanski announced his sentence, the 22-year-old Fields, accompanied by one of his lawyers, walked to a podium in the courtroom and apologized.

"Every day I think about how things could have gone differently and how I regret my actions," he said. "I'm sorry."

His comments came after more than a dozen survivors of and witnesses to the attack delivered emotional testimony about the physical and psychological wounds they had received as a result of the events that day.

"You had a choice to leave Charlottesville, but you did not," said Rosia Parker, a longtime civil rights activist in Charlottesville who said she was standing feet away from Heyer when Heyer was struck by Fields' car.

"You could have done anything else but what you did," Parker said, her voice breaking as she stared directly at Fields. "So, yeah, you deserve everything that you get."

Fields appeared stoic and didn't look at Parker or any of the victims as they spoke.

Heyer's mother, Susan Bro, said she wanted Fields to spend his life in prison but also hoped he would get the medication he needed and that one day he would change his views and no longer support white supremacy.

"I hope he can heal someday and help others heal," Bro said.

After the hearing, Bro said she did not believe Fields' apology was sincere, but instead was a last-ditch attempt to get a lighter sentence.

Fields drove from his home in Maumee, Ohio, to attend the "Unite the Right" rally on Aug. 12, 2017, which drew hundreds of white nationalists to Charlottesville to protest the planned removal of a statue of Confederate Gen. Robert E. Lee.

Hundreds of counterprotesters showed up as well.

President Donald Trump sparked controversy when he blamed the violence at the rally on "both sides," a statement that critics saw as a refusal to condemn racism.

After Fields was sentenced, a Department of Justice official condemned his actions.

"Hate crimes violate the most fundamental American values of freedom and human dignity," Eric Dreiband, assistant attorney general for the DOJ's Civil Rights Division, said at a news conference with federal prosecutors.

"The bigotry and ideology of neo-Nazism, Nazism, white supremacy and the Ku Klux Klan are a disgrace to this country and illegal acts based on those should be eradicated from the United States," Dreiband said.

Prosecutors said Fields had a long history of racist and anti-Semitic behavior and had shown no remorse for his crimes. They said he is an avowed white supremacist, admired Adolf Hitler and even kept a picture of the Nazi leader on his bedside table.

During the sentencing hearing Friday, FBI Special Agent Wade Douthit said a classmate described Fields as being "like a kid at Disney World" during a high school trip to the Dachau concentration camp in Germany.

Douthit read grand jury testimony from the classmate, who said Fields appeared happy and made the remark, "This is where the magic happened."

The statement provoked audible gasps from the crowd that had packed into the Charlottesville courtroom.

The classmate said when Fields viewed the camp's gas chamber, he said: "It's almost like you can still hear them screaming."

Douthit said the classmate was so disgusted by Fields' remarks he stopped associating with him.

During Fields' state trial, attorneys focused on his history of mental illness and traumatic childhood.

A psychologist testified that Fields had inexplicable volatile outbursts as a young child, was diagnosed with bipolar disorder at age 6 and was later diagnosed with schizoid personality disorder.

In a sentencing memo, defense attorneys said Fields was raised by a paraplegic single mother and suffered "trauma" knowing that his Jewish grandfather had slain his grandmother before taking his own life.