The satire was, by the writer’s own admission, unfunny, beyond crude and hardly worthy of the name. Its target was an increasingly despotic political leader, who reacted with predictable rage. But the most remarkable thing about Jan Böhmermann’s abusive televised “poem” about Recep Tayyip Erdoğan is that neither the author nor his subject have come out worst from the affair. Instead, the reputation taking most of a knock is that of a woman whose sure political touch has made her the towering figure of a continent for a decade. By giving the green light for Mr Böhmermann’s prosecution for mocking a foreign government, under an obscure section of Germany’s 19th-century penal code, she has indulged repression abroad, and tarnished her own country’s reputation for freedom. So how on earth did Angela Merkel allow a joke to go so wrong?

The official explanation, such as it is, starts with Germany being a “law-based state”, a cliche of understandable force in the federal republic. The tricksy twist, however, is then to claim that seeing as the law must operate without fear or favour, the consequences of section 103 of Bismarck-era criminal code, which proscribes insulting foreign leaders, cannot be avoided, no matter how regrettable they may be. The law is an ass, Mrs Merkel is saying, but it’s the law that we’ve got, and so it must be respected until we get around to changing it, which – by the way – I promise we will.

It is a case that doesn’t stack up. In general, the prosecution of crimes in lawful societies is not automatic, but subject to the public interest. Were it not so, arcane English laws would, for example, have led to prosecutions for failure to perform medievally mandated archery practise being pursued into the industrial age, and would – even to this day – result in Halloween trick-or-treaters being charged under old strictures about “wilfully and wantonly” knocking on doors. In the specific case of Germany’s section 103, about slighting foreign states, the government must expressly approve the prosecution, presumably because the whole original purpose was to deploy the criminal law as an instrument of foreign policy. It is, then, a political decision, and indeed one provoking discord in Mrs Merkel’s cabinet. Thickening the plot is the existence of a possible escape route, involving Mr Erdoğan pursuing the offence caused through an individual claim, which would not have relied on his absurd privileges as a dignitary.

The only way to make sense of this prosecution is to set it in the context that the law’s 19th-century drafters probably envisaged: international relations. Mrs Merkel is in the midsts of fraught negotiations with Ankara to flesh out the grand bargain on migrants which the EU hastily scrambled together last month. As the chancellor arrives in Gaziantep province on Saturday, now home to many displaced Syrians, difficult details regarding visa-free travel concessions and other things could still scupper her strategy of Turkey taking back migrant boats turned back by the EU, in return for the EU taking people from the camps. But at the same time she is under pressure at home to take on the Turks over their worsening human rights record. Placating Mr Erdoğan by prosecuting his tormentor might seem a relatively painless way to ease some of the dilemmas here, especially if – as is surely possible – the courts decline to convict Mr Böhmermann in the end.

There is, however, a price to pay for playing unprincipled realpolitik with a question of individual justice, as Mrs Merkel is finding out. As well as the domestic political cost, she risks – at best – lending legitimacy to Mr Erdoğan’s increasingly vicious intolerance towards journalists asking awkward questions. And, at worst, emboldening every over-sensitive authoritarian leader around the world to start demanding that foreign courts step in to save them from being mocked.