Turkish President Recep Tayyip Erdogan. (AFP)
The case was brought to the European Court of Human Rights by a Turkish man, Vedat Sorli, who was sentenced to nearly a year in jail in 2017 for "insulting" Erdogan over Turkey's role in the Syrian civil war.
A first Facebook post by Sorli from 2014 showed Erdogan wearing a dress and kissing US president Barack Obama, with the Kurdish caption: "Will you register ownership of Syria in my name, my dear husband?"
Two years later, he posted photos of Erdogan with a diatribe that ends with "May your presidency, your power and your ambitions be buried in the depths of the earth."
Sorli was held for two months in pre-trial detention, though the subsequent prison sentence was suspended.
The court found that the conviction had a "chilling effect" that discouraged criticism and constituted a violation of Sorli's freedom of expression.
It also said the Turkish law imposing harsher punishments for anyone convicted of insulting the president "against the spirit" of the European Convention on Human Rights, which Ankara ratified in 1954.
"A state's interest in protecting the reputation of its head of state could not serve as justification for affording the head of state privileged status or special protection vis-a-vis the right to convey information and opinions concerning him," it said.
The court has issued a series of rulings against Turkey in recent years over its crackdown on opposition groups, in particular Kurdish separatist activists considered a terrorist threat.
It ordered the government to pay Sorli 7,500 euros ($8,750) in damages.