BERLIN (AP) — The German government passed a new law on Wednesday making hate-motivated insults a criminal offence that can be punished with a monetary fine or prison of up to two years.

Germany’s justice minister said the new law is meant to protect Jews, Muslims, gays, people with disabilities and others.

“It is our responsibility to protect every single person in our society from hostility and exclusion,” Christine Lambrecht said, the German news agency dpa reported.

The new measure, which still needs parliamentary approval, includes insulting hate messages sent as texts, emails or letters.

“Members of Jewish or Muslim communities are being taunted and disparaged,” Lambrecht said.

Hate crimes and attacks against minorities have been on the rise in Germany in recent years and with the skyrocketing use of social media, targeted insults are becoming commonplace, groups that track hate crimes say.

Under existing legislation, because the insults are personal and not public, they couldn’t be punished as incitement to racial hatred.