He was convicted of rape, serious sexual assault and grievous bodily harm. The girl he attacked was attending the school where he had also been a pupil.
The 30-year-old admitted the attack on the first day of the trial, and even his own lawyers said he had committed an outrageous crime.
He said he had drunk a lot of alcohol the night before, and taken cocaine, something Judge Iris Berger said had somewhat reduced his accountability, since it had increased his aggression.
He had grabbed the girl randomly and pulled her into the toilet, threatening her with a knife before raping her and even biting her face.
“This aggression is like a red thread through your life,” she told the man, jailing him for six and a half years.
Prosecutor Andrea Läpping said he had behaved in a “brutal and ruthless fashion” towards one of the weakest members of society. “He was aware of what he was doing,” she said.
The man, who has not been identified, told the court he was ashamed of what he had done.
He was arrested nearly four weeks after the March 1 attack, which prompted parents to launch security patrols at the school.