Jan Böhmermann said that he set out to test the boundaries of satire with his poem about the Turkish president © Getty

German comedian Jan Böhmermann has been banned from repeating most of the obscene poem he wrote about Turkish president Recep Tayyip Erdogan, which strained relations between Germany and Turkey.

A Hamburg court rejected a bid from Mr Erdogan to have the whole poem prohibited but it imposed a gagging order on the many passages involving sexual references.

The Tuesday evening judgment may slightly ease the scandal over Mr Böhmermann, which has damaged ties between Berlin and Ankara just when chancellor Angela Merkel is anxious to maintain Turkey’s co-operation in a fragile agreement for tackling the refugee crisis.

However, the Hamburg case is separate from a more serious criminal complaint filed by Mr Erdogan alleging that he was insulted by Mr Böhmermann under an obscure German law outlawing the insulting of foreign leaders.

Mr Böhmermann, 35, first read his verses, in which Mr Erdogan is accused of having sex with sheep and goats, on his late-night comedy show, broadcast on March 31 by public television station ZDF. While ZDF took down the programme shortly after the political storm broke, it has remained available elsewhere on the web and was last week read out in parliament.

The Hamburg court tried to steer a line between free speech and protecting individuals from insulting behaviour: it said that while the poem as a whole was satire, this did not entitle the author to “the wholesale disregard of the rights of the complainant”.

It added that limits of acceptability had been breached by “the use of racist stereotypical prejudices and religious denigration, and . . . the sexual references in the poem”.

Christian Schertz, Mr Böhmermann’s lawyer, said the court had make a mistake in selecting passages from the text and banning them. That went against “artistic freedom”.

Mr Böhmermann, who made clear in his original broadcast that he knew he would be breaking the law, responded to the judgment by tweeting a link to the Beastie Boys song “(You Gotta) Fight for Your Right (To Party)”.

The comedian plans to appeal against the injunction, which runs for an initial period of four weeks. Mr Schertz said the case could go to the German Constitutional Court, if necessary.

Ms Merkel’s government is now pushing parliament to repeal the law protecting foreign leaders from insults. But officials have said that the repeal would not be retrospective, leaving Mr Erdogan free to pursue his criminal case.

Under the legal code, the Turkey president was able to file his complaint only after the government gave its permission — a decision which exposed Ms Merkel to attack from liberal defenders of media freedom. But the government’s view is that there was no good legal reason to turn away Mr Erdogan — and that the law must now run its course.

Ms Merkel is due to visit Istanbul this Sunday for a United Nations conference on emergency aid and will hold talks with Turkish government officials, almost certainly conferring with Mr Erdogan himself.

The Böhmermann case is especially sensitive because Germany and the EU are pressing Mr Erdogan to row back on recent assaults on media freedoms in Turkey.

Local journalists are facing one of the worst crackdowns on press freedoms since military rule in the 1980s, with Mr Erdogan bringing defamation charges against hundreds of people since becoming president in 2014.

Get alerts on Germany when a new story is published

Copyright The Financial Times Limited 2019. All rights reserved.

Comments have not been enabled for this article.

Follow the topics in this article