Luis Alberto Gonzalez could have faced up to 60 years prison under Florida’s hate-crime law after his conviction on charges he tried to run his truck over two black men while yelling racial slurs in Hialeah.

But Gonzalez, who was shot by a black man during Miami’s McDuffie race riots of 1980, had a distinguished supporter in tow at Wednesday’s sentencing hearing: African-American scholar and historian Marvin Dunn, who insisted the convict was no racist.

“Mr. Gonzalez is an intemperate alcoholic who is prone to acting out with rage, but this does not make him a bigot,” Dunn wrote in a report submitted to the court.

His words had an effect: Miami-Dade Circuit Judge Jorge Rodriguez-Chomat, noting Dunn’s report, sentenced Gonzalez, a repeat felon with more than a dozen previous convictions, to just 12 years prison.

“I don’t believe he’s a racist by nature, but according to the jury verdict, he acted in a way that was influenced by race and the color of the skin,” Rodriguez-Chomat said.

The sentence capped a unique case that wove together painful racial storylines of Miami’s past and present. Gonzalez, 52, who was born in Cuba, had long lived in Hialeah, a heavily Hispanic city with few black residents.

Prosecutors say he had been seething for more than 30 years over being shot during the 1980 riots that were sparked by the acquittal of Miami-Dade police officers accused of killing black motorcyclist Arthur McDuffie.

Four white and Hispanic officers, prosecutors said at the time, savagely beat McDuffie to death after he led them on a high-speed chase. After the acquittal, riots erupted, killing more than a dozen people and causing catastrophic damage to Miami’s inner city.

In this case, prosecutors said, Gonzalez saw a chance to exact revenge against Andy Alexander and Jarvis James, both in their early 20s, when their SUV got a flat tire in Hialeah on the way to class at a school for security guards just before 5 p.m. on Jan. 2, 2012.

After the Chevrolet Trailblazer was towed to Festival Tires, 4696 Palm Ave., the men, who had no criminal history, walked over to a nearby Walgreens to get change. According to prosecutors, as they passed Jerry and Joe’s Pizza, Gonzalez spotted them, yelled the n-word and asked why they were in Hialeah.

Gonzalez later told police the men “looked arrogant” so he hopped in his truck and tried to run them down.

James whipped out a .25 caliber pistol, jumped out of the way and fired three times, striking Gonzalez once in the neck. The truck missed Alexander by only a few inches, police said.

Gonzalez lost control of his pickup and plowed into a nearby funeral home.

Afraid no one would believe them, James and Alexander ran to get their SUV from the repair shop and left Hialeah, prosecutors said. Investigators later tracked them down and questioned each separately. Each told the same story. Authorities later ruled their use of a firearm was justified as self defense.

In a recorded statement, Gonzalez admitted his resentment toward blacks but said he drove at the men to scare them.

Prosecutors originally charged Gonzalez with attempted murder with “prejudice.” At trial, defense attorneys called Alexander and James “hip-hop” punks and said they were the real criminals.

Jurors convicted Gonzalez of aggravated assault with a deadly weapon with prejudice — a hate crime, which could have increased his sentence to 60 years.

At Wednesday’s sentencing, Gonzalez’s lawyer, David Sisselman, said his client suffered brain damage after being shot in the riots. Gonzalez himself tearfully admitted he became an alcoholic by age 25, racking up a staggering 15 convictions, most for drunk-driving and serious traffic offenses, over the years.

His sister, Clara del Pozo, said Gonzalez had black friends, and had even been rushed to the hospital by a black family when he was shot during the riots.

“The way we were brought up in Cuba, everybody is the same,” she told the judge. “Here it was the same. Luis never showed he was a racist.”

The key testimony Wednesday came Dunn’s report. In his report, Dunn — a psychologist, race-relations expert and professor at Florida International University — said the hate-crime law could not be applied fairly in all cases.

Dunn noted that many more African Americans use the n -word as a “term of endearment” to each other, and use of the word by any other race amounts to “free speech” and should not be subject to prosecution.

“Has a black person in Miami-Dade County ever been prosecuted for acting with prejudice against a white person or is this violation of this law a risk to which only whites can be subjected?” Dunn asked.

The professor also questioned whether Gonzalez could even be categorized as white — because many Hispanics have “Spanish blood saturated with African blood.”

Dunn, who will earn about $1,500 for his report because he was hired by the defense as an expert witness, has served as a witness in over 20 criminal cases.

Miami-Dade prosecutors Breezye Telfair and Manolo Reboso asked the judge to sentence Gonzalez to 30 years in prison. They said they respected Rodriguez-Chomat’s decision.

“The victims in this case have always expressed forgiveness in their hearts for Luis Gonzalez and today the judge showed him mercy,” Telfair said.