Bruno Weber, a councillor in the northern town of Amstetten, appeared before the court over racist and homophobic comments he left on a Facebook post about a recent advertising campaign by the Austrian state railway company ÖBB.
The advert was for the company's family discount card and showed two men -- one of them non-white -- with a baby.
Weber commented that the image was "filth" and went on to describe those depicted with racist and homophobic slurs including the German equivalent of the N-word.
Weber was prosecuted for incitement to hatred, with the court in Linz giving him the option of avoiding a criminal conviction if he agreed to attend a course on good manners online, which has been run by the Neustart NGO since
late last year.
Neustart says the six-month course is part of efforts to combat online hate speech and aims to get participants to "understand why their behaviour is wrong, and to recognise how they can express their opinions without denigrating others".
Proceedings against Weber will be closed for good after a two-year probation period in which his behaviour will be monitored.
Weber accepted the option of going on the course and explained that his outburst was the result of posting late at night after several beers.
The image did not fit his image of what a family is, he explained, adding that he didn't know the N-word was offensive.
According to figures from the Austrian justice ministry, 827 cases of incitement to hatred were filed in 2017, up from 516 in 2015, with the number of successful prosecutions going up from 49 to 107 over the same period.