BERLIN — Turkey’s president found himself in choice company when he fixed upon an obscure German law to attempt to punish a popular comic who had satirized him in crude terms. The same law, dating from 1871, had also been used to silence critics of the Shah Mohammed Reza Pahlavi of Iran and the Chilean dictator Augusto Pinochet.

Devised during an era of ruffled majesties, the law allows prosecution in Germany for insulting a foreign leader, but only with the consent of the government. It also presented Chancellor Angela Merkel with a dilemma: She could either compromise on cherished values of free speech or risk further roiling relations with a leader she needs to stem another potentially chaotic flood of refugees to Europe again this year.

On Friday, Ms. Merkel gave President Recep Tayyip Erdogan of Turkey what he was seeking. She announced that prosecution of the satirist, Jan Böhmermann, could proceed — even as she added that the law allowing it would be repealed.

The attempt to split the difference did little to appease criticism that Ms. Merkel had blinked in the staring contest with Mr. Erdogan. “We just experienced the beginning of the end of Chancellorship #Merkel,” wrote another satirist, Oliver Kalkofe, on Twitter. “I am ashamed by the lack of spine.”