The young black man sat in a big leather chair in his lawyer’s office, recounting the song that one of his team-mates on the Dietrich high school football team had taught him.

He sang it, the lawyer said, “like it was the Star-Spangled Banner. He didn’t know what it meant.”

“Moon man, moon man, can’t you see,” he sang, “Spics and niggers need to hang from trees.”

The song disparaged black people, Latinos, Jews and gay men, and glorified anal rape and the KKK.

The young man, who is developmentally disabled, was allegedly raped with a coat hanger 18 months ago by John RK Howard, the white team-mate who taught him the song, and two other football players.

On Friday, Howard will be sentenced – but after agreeing to a plea bargain designed to limit his punishment, he will avoid prison. The prosecutor in the case claimed the attack, which occurred after months of racial abuse and bullying, was not racially motivated and did not constitute a sex crime.

He agreed that Howard could sign a so-called Alford plea, in which he maintains his innocence but, according to court documents, agrees that “there is sufficient evidence for a jury to convict me”. Details of Howard’s punishment will not be unveiled until Friday, but he is potentially facing little more than probation, 300 hours of community service and classes in racial sensitivity.

The case has prompted comparisons with the notorious Brock Turner case, in which the 20-year-old former Stanford swimmer was convicted of multiple felonies for sexually assaulting an unconscious woman. Turner was sentenced to just six months in prison and served only three, a punishment that sparked a global firestorm from critics who argued it was overly lenient.