BERLIN — A German court has ruled that a comedian’s comments calling a leading figure in the nationalist Alternative for Germany party a “Nazi slut” on a television show were satirical and thus protected speech.

The Hamburg state court on Wednesday rejected a complaint from Alice Weidel, who is co-leading the anti-immigration party’s campaign for September elections. She had contended that the comments by comedian Christian Ehring on April 27 were defamatory.

Ehring, commenting on a recent Weidel statement that political correctness belonged on the scrapheap of history, said on the satirical show Extra 3: “OK, out with political correctness, let’s all be incorrect — there the Nazi slut is right.”

Party spokesman Christian Lueth says the decision against “such an aggressive defamation” will be appealed.