Just when German Chancellor Angela Merkel thought she had checked “Turkey” off her to-do list for solving Europe’s refugee crisis, a filth-laden poem read by a late-night comic is presenting her with a new dilemma.

Two weeks ago, comedian Jan Boehmermann recited a 24-line ditty on German public broadcaster ZDF describing the Turkish president as a pedophile who engages in sex acts with animals. Now Recep Tayyip Erdogan is demanding that Merkel’s government sanction an investigation under an obscure German law that prohibits insulting foreign leaders.

If Merkel blocks the investigation, she risks incensing Erdogan — a key partner in stemming the flow of refugees to Europe — even more. If she allows it, she lets the prickly Turkish leader export his assault on freedom of speech to Germany. Bild, Germany’s largest circulation newspaper, calls Merkel’s quandary “a serious international crisis.”

“Angela Merkel can only lose. In fact she’s already lost,” wrote one commentator in Spiegel Online. “The whole country sees that Erdogan has the chancellor in hand and can lead her around like in a circus ring.”

Merkel, eager to stop the exodus of refugees from Syria’s civil war to Europe, cut a controversial deal with Turkey last month. In return for taking back migrants crossing illegally into the European Union, Ankara will get billions of euros in assistance, visa-free travel for its citizens, and a faster track to EU membership.

Merkel’s critics had a field day. German comics broadcast a satirical song about Erdogan, “the boss from the Bosphorus,” with a video mocking his giant residence and treatment of journalists and minorities. The Turkish government reacted angrily, summoning the German ambassador in Ankara. That’s where Boehmermann, not exactly a household name, came in.

In his weekly show “Neo Magazin Royale” on March 31, the 35-year-old comedian intentionally tested the limits of Germany’s right to free expression, bantering with a colleague that what he was about to say was verboten under German law.

Calling the 121-word poem juvenile would be an insult to teenagers. Erdogan predictably blew his top; ZDF pulled the offending broadcast from its website; and Merkel was forced to have an awkward phone conversation with Turkish Prime Minister Ahmet Davutoglu in which she acknowledged that the poem was “deliberately offensive,” according to her spokesman.

On Tuesday, Merkel insisted that the refugee deal with Turkey was “completely detached” from the ruckus over Boehmermann, probably making her the only person in Germany who didn’t make that connection. Erdogan is undoubtedly a problematic partner, but Merkel can’t afford to lose him at a time when the number of migrants reaching Europe begins to ebb.

As easy a target as Erdogan makes himself for humorists, it’s hard to ignore the negative stereotypes about Turks — Germany’s largest ethnic minority — that played into Boehmermann’s skit. As a huge Turkish flag waved in the background, Boehmermann first addressed “dear Turks” and lectured them about the freedom of expression anchored in the German constitution. His scandalous poem wasn’t complete without a reference to smelly kebabs.

Another problem with Boehmermann’s performance is that it barely qualifies as satire. While the song that originally inspired Erdogan’s wrath is actually funny, the offending poem is simply a string of crudities that the author himself announces is a violation of German law. The purpose isn’t irony but provocation.

There isn’t anything particularly brave about a German comedian testing the limits of free expression in Germany. Whatever happens — and the worst will likely be a fine — Boehmermann emerges as a champion of free speech and a great comic. Turkish journalists persecuted by Erdogan, the real victims in this story, aren’t helped one bit.

To act like anything and everything can be said is disingenuous. Every democracy puts limits — via laws and norms — on the type of speech acceptable in public. In the United States, it’s the use of the “N-word;” in Germany, the defamation of Jews or denial of the Holocaust. It’s doubtful Boehmermann would have considered reciting a similar poem about an Israeli leader.

Instead of basking in the free publicity, Boehmermann has gone into hiding. He and his family are reportedly under police protection, and the comedian canceled this week’s show.

In the meantime, the German government’s legal experts are deliberating whether a case is warranted under the law that bans insulting foreign leaders. Even if they decide against it, Erdogan has also filed a defamation suit as a private person in a German court. The Turkish president will exhaust all legal options to have Boehmermann punished and stop him from repeating his insults, Erdogan’s German lawyer told ZDF on Tuesday.

It’s taken another comedian, Dieter Nuhr, to propose a much better solution. Nuhr has suggested that Erdogan write a response to Boehmermann in verse. Then the two can duke it out to see whose poem is worse.