The German chancellor, Angela Merkel, has insisted she will not compromise on fundamental democratic principles to protect the EU’s refugee deal with Turkey after the Turkish president sought the prosecution of a German comedian for a crude poem about him.

“I want to stress again what was stressed yesterday – we have the fundamental values in the constitution and that includes article 5, which is the freedom of opinion, freedom of science and of course, the freedom of art,” she said when asked about a complaint filed by Tayyip Erdoğan against Jan Böhmermann on Monday.

“Art and these fundamental values are valid regardless of any political problems we discuss with each other – and that includes the refugee issue – and I think Turkey and the European Union and so also Germany have an interest in finding a political solution on it,” Merkel said.

Merkel finds herself in a difficult situation after the Turkish government formally requested that Böhmermann be prosecuted for a “smear poem” about Erdoğan. Merkel has been one of the main figures behind an EU drive to secure Turkey’s cooperation in dealing with the refugee crisis.

Jan Böhmermann read the poem on ZDF television two weeks ago. Photograph: Ullstein Bild/via Getty Images

The production company behind Böhmermann’s TV programme, Neo Magazin Royale, said this Thursday’s episode had been cancelled, citing “enormous media attention and the focus on the show and its host”.

Under paragraph 103 of the German criminal code, which concerns insults against organs or representatives of foreign states, the comedian could potentially face a jail sentence of up to five years.

Artists and politicians have expressed their solidarity, including the former Greek finance minister Yanis Varoufakis, who was the subject of a Böhmermann hoax.

Europe first lost its soul (agreement with Turkey on refugees), now it is losing its humour. Hands off @janboehm! https://t.co/w6bTJjp0QG — Yanis Varoufakis (@yanisvaroufakis) April 11, 2016

Some commentators have gone as far as suggesting the affair could bring about the end of Merkel’s chancellorship. “If she allows the trial to go ahead,” commentator Stefan Kuzmany wrote in Der Spiegel, “everyone from conservative anti-Turks to newly converted Merkelians would wake up to her undignified kowtowing in front of this egomaniacal refugee dealer. If she stops the trial, she risks the end of the deal with Turkey – and the ugly pictures from Idomeni will be just a taster of what we will see on EU borders.”

Böhmermann read the poem on ZDF television two weeks ago to illustrate what he said would not be allowed in Germany, contrasting it with another channel’s satirical song, which also poked fun at Erdoğan.

Germany’s ambassador was summoned to the foreign ministry in Ankara last month to hear Turkey’s objections to the song.

While the German government defended the song as legitimate free speech, it has distanced itself from the poem, labelling it last week as “deliberately offensive”.