GERMANY’S STATE BROADCASTER, ZDF, apologized on Friday for what it called satire that had crossed the line into slander and removed video of a comedian reading an obscene poem about Turkish President Recep Tayyip Erdogan from its website and YouTube channel.

The poem, which was read by the German satirist Jan Böhmermann on Thursday’s edition of his late-night show “Neo Magazin Royale,” described Erdogan in vile, obscene terms — even comparing him, at one stage, to Josef Fritzl, an Austrian man who fathered seven children with a daughter he held in a cellar for 24 years — but the text was presented as part of a comic demonstration of the difference between satire and slander.

Although video of the entire show has disappeared from ZDF’s official channels, an excerpt of the segment, with Turkish subtitles, can be viewed on the website of Bild, the German tabloid. The clip includes a reaction shot of Ralf Kabelka, Böhmermann’s sidekick, frowning at one particularly egregious line.

As Alexander Kühn explained in a column on the segment for Spiegel Online, the conceit of the sketch was that Böhmermann was, in faux innocence, trying to understand where the line between satire and defamation was, by reading lines from the poem that might be considered slanderous. Kabelka was helping him by listening and pointing out what could not be said on television.

The issue has been in the news all week in Germany because of the Turkish government’s official complaint about a music video mocking Erdogan, which was broadcast on another German television channel. Turkey’s foreign ministry tried, and failed, to convince the German government to have that relatively mild spoof removed from the internet.

Erdogan, who is visiting Washington this week, along with his heavy-handed security detail, said in an interview with Christiane Amanpour on Thursday that he was “open to criticism,” but “we shouldn’t confuse criticism with insult and defamation.”

He added that he had no problem with “a simple sketch,” but “satire with the president of a country at its core, which results in defamation and insults, is something different.” Pressed by Amanpour as to why he did not simply ignore such jokes, Erdogan said that he reserved the right to sue anyone whose mockery of him insulted the Turkish voters who had elected him.

ZDF’s director of programming, Norbert Himmler, said in a statement that the network gives wide latitude to its satirists, “but there are also limits to irony and satire. In this case, they were clearly exceeded.”

Although the Erdogan sketch is no longer online, one inspired piece of Böhmermann’s show from Thursday remains on YouTube. It is a music video mocking xenophobic German nationalists who were caught on video in February hurling insults at terrified Muslim refugees, and chanting, “We are the People!”

Böhmermann was repulsed by footage of that incident of a mob surrounding a bus outside temporary accommodation in the village of Clausnitz, 19 miles south of Dresden.

As he and others noted, the use of the phrase “We are the People” (“Wir sind das Volk” in German) was particularly disturbing because it had been appropriated by the anti-immigrant nationalists from a slogan used in protests against the East German government in 1989. In the past two years, it has been adopted by a group known as Pegida — a German acronym for a name that translates roughly as Patriotic Europeans Against the ‘Islamization’ of the West — which holds mass rallies against Muslim immigrants in Dresden and other cities in the former East Germany.

Böhmermann’s response to the incident is the very funny song “Be Deutsch!” first broadcast on Thursday, in which he praises — in English, to a German metal beat — the virtues of a more tolerant, Birkenstock-wearing, multicultural, modern Germany that is standing up to the nativists. “Say it clear, say it loud,” the chorus goes, “We are proud of not being proud!”

The song, which was promoted on social networks with the hashtag #MakeGermanyGreatAgain, was also partly inspired by the rise of similar groups in other countries, and goes on to compare Erdogan and Donald Trump to Hitler. “Maniacs with wicked hair,” Böhmermann sings, “Ja, ja, ja, we have already been there.”