Facing up to 10 years in prison and a $250,000 fine after being convicted of a hate crime against a 7-year-old boy and his father, Mark Olic Porter went on a racist rant in court before he was sentenced to nine months in prison Thursday.

Appearing before U.S. District Judge Dee Benson, Porter said African-Americans are pimps, drug dealers, violent and dangerous.

“ We weren’t surprised by the defendant’s statements in the courtroom, because that’s who he’s proven himself to be,” said Dave Backman, chief of the U.S. attorney for Utah’s criminal division. “It was hard to sit through that hearing because of that.”

In handing down the nine-month sentence, Benson told Porter he’s a racist — but that his actions, not his thoughts, were illegal.

Porter was arrested after an incident Nov. 3, 2016. As a then-7-year-old boy rode his scooter in the courtyard of a Draper apartment complex where he lived, Porter — also a resident — yelled, “Get out of here, n-----!‘”

The boy’s father, Mike Waldvogel, testified that when he told Porter not to talk to his son that way, Porter yelled, “You and your n----- son can get out of here!’”

Waldvogel said Porter then hit him on the left side of his neck with an electrified Zap Cane, leaving him “pretty much incapacitated.”

Porter was arrested by Draper police and charged with aggravated assault, along with interference with and assault on police officers as well as intoxication. The state counts were dropped in favor of the federal hate crime charge.

In an FBI body-cam video recorded when Porter was arrested in Arizona (where he moved after the incident) and played in court during the trial, he admits he called the boy a “little stinking n-----.” And he told the FBI agents, “M aybe they’ll arrest me for my saying this, see, Hitler had the right idea. The wrong people. Should have gassed n------.”

Benson gave Porter credit for time served; he’s been jailed since his arrest eight months ago and is eligible for release June 15. He will also serve one year of probation. He was not fined.

Prosecutors had asked for a stronger sentence — 37-46 months — that would “represent the significance of this crime,” U.S. Attorney for Utah John Huber said after the verdict.

Backman said federal prosecutors were “somewhat surprised by the sentence,” but he did not second-guess Benson.

“ Overall, we’re very happy with the outcome of this case because it sent a strong message,” he said, adding that Porter “was convicted of a very serious federal felony that will never go away. He was sentenced to prison.”

Waldvogel released a statement that he and his family “are extremely disappointed in the judge’s decision regarding the sentencing. It’s sad and disheartening. Mr. Porter is a violent and hateful individual who has deep-rooted erroneous beliefs. We hope that no one else becomes a victim at the hands of Mr. Porter in the future.”

Backman said Waldvogel’s disappointment was “understandable.”