A court ruled that German public broadcaster ZDF was within its rights to refuse airtime to a campaign advertisement of the extreme-right National Democratic Party (NPD), the Rhein Zeitung newspaper reported Saturday.

The commercial violates Germany's criminal code and threatens public order by "maliciously attacking the dignity of foreign residents of Germany," the court in the western city of Mainz reportedly said in its ruling.

Read more: Angela Merkel's Cabinet greenlights motion to cut off extreme-right NPD from state funding

A higher administrative court subsequently rejected the NPD's appeal against the verdict late on Friday. The party can file a further appeal at Germany's Constitutional Court.

The NPD wanted the ad to air on Monday ahead of elections to the European Parliament in late May. Public broadcasters are required to transmit electoral commercials unless their content is illegal.

Read more: A guide to Germany's right-wing groups

Watch video 00:36 Court rules against NPD ban

The ultranationalist party has one seat in the European Parliament and several hundred seats in municipal assemblies throughout Germany. It has no representatives in the German parliament or in any of the 16 state parliaments.

Mainstream lawmakers have twice requested that the Constitutional Court ban the NPD as a threat to the democratic system. The most recent attempt failed in 2017 after judges ruled that the party was too small to pose a genuine threat.

Read more: The decline and fall of Germany's 'neo-Nazi' NPD

amp/aw (AFP, epd)

Every evening, DW sends out a selection of the day's news and features. Sign up here.