Jan Boehmermann, host of the late-night "Neo Magazin Royale" on the public ZDF channel is pictured during a TV show of Markus Lanz in Hamburg, Germany, August 21, 2012. REUTERS/Morris Mac Matzen/Files

BERLIN (Reuters) - German public broadcaster ZDF will help comedian Jan Boehmermann fight any case brought by prosecutors for mocking Turkey’s President Tayyip Erdogan after Chancellor Angela Merkel agreed to allow them to pursue the case on Friday.

Erdogan had demanded that Germany press charges against Boehmermann after he recited a poem about the Turkish leader in a show on ZDF on March 31, suggesting he hits girls, watches child pornography and engages in bestiality.

A section of the German criminal code prohibits insults against foreign leaders but leaves it to the government to decide whether to authorise prosecutors to pursue such cases.

“We will accompany him through to the highest courts,” ZDF director general Thomas Bellut told Der Spiegel magazine.

Bellut said the case pushed boundaries, and he had therefore decided to pull the poem from the ZDF website due to his own “personal moral values”, but the ZDF editor who approved the broadcast should not fear any disciplinary consequences.

“It wasn’t easy for me, but I still think it was the least bad decision that I could take,” Bellut said.

On Friday, Merkel said the decision to allow prosecutors to investigate was not a verdict on the merits of the case itself, but she came under fire from the Social Democrats (SPD), her centre-left coalition partner, which had wanted the Turkish request to be rejected.

Merkel was in an awkward position. She has been the driving force behind a European Union deal with Turkey to stem the flow of refugees into Europe and critics have already accused her of ignoring violations of human rights and media freedoms in Turkey to secure its cooperation.

The cult comedian, who said before reciting the poem that he was intentionally going beyond what German law allowed, is reportedly under police protection and has cancelled his last show on ZDF.