The 16-year-old Turkish student detained Wednesday for insulting President Recep Tayyip Erdoğan in a speech hailing Turkey’s secular traditions was released Friday. The release came after lawyers and the journalists decried heavy-handed enforcement of a law that prohibits insulting the country’s president.

The teenager, known public only by the initials M.E.A., had participated in a rally in Konya, 160 miles south of Ankara, honoring the anniversary of the killing by Islamists of a secular army officer in 1930. The boy still faces up to four years in prison under Turkey’s version of insult law.

At the rally the teen lashed out at Erdoğan’s ruling Justice and Development Party, accusing it of corruption. He also described the president as "the thieving owner of the illegal palace,” a reference to the new 1,100-room $615-million presidential estate many in Turkey view as a symbol of Erdoğan’s efforts to consolidate power under the presidency.

"Only dictators want to live in palaces," opposition lawmaker Izzet Cetin was quoted by NPR as saying about the complex built on what was formerly a forested area outside of the capital. "Normal heads of state live in relatively modest compounds."

The former Istanbul mayor served as prime minister for 11 years before being elected president in August.  

Article 158 of Turkey’s Criminal Code states that “whoever insults the president of Turkey in his presence, or engages in aggressive publication against the president of Turkey shall be punished by heavy imprisonment for not less than three years.” The legal definition of insult includes “allusion or hint” even if the president’s name isn’t explicitly stated.

Many European states, including the Netherlands and Norway, still have insult laws on the books, a historical vestige of the concept of lèse-majesté that dates back to ancient Rome. Through history levies up to death have been imposed against anyone insulting a sovereign leader, or even talking bad about the state itself.

It’s highly unlikely people would go to jail in Europe for insulting a member of royalty, but the laws are more harshly applied in more authoritarian states, including Saudi Arabia, Belarus and Cambodia. Earlier this year Bahrain increased the penalty for insulting the king, up to seven years in prison and a maximum fine of $26,500.