In France there is an offence called "outrage à personne dépositaire de l'autorité publique", contempt/insult to someone holding 'public authority' (police, elected official, etc), which is the basis for this. There is a similar offence for insults against civil servants and public workers (inc. teachers, public transport employees, etc).
impish9208•4h ago