A Turkish court on Friday ordered the release of a 16-year-old high school student arrested for "insulting" President Recep Tayyip Erdogan, following an outcry over his detention.
The boy, Mehmet Emin Altunses, was released following a complaint by his lawyer over his arrest in the central city of Konya, the Dogan news agency reported.
He was met by his parents as he left the main courthouse building in the city, the CNN-Turk channel reported.
He had delivered a speech on Wednesday in Konya, a bastion of the ruling Islamic-rooted Justice and Development Party (AKP), where he had reportedly accused Erdogan and the ruling party of corruption.
The boy, who was arrested by police at school, during questioning denied links with a political party but confirmed he had made the statements in question.
Despite his release, he still remains accused of insulting Erdogan and faces trial at a date yet to be specified. He risks up to four years in prison if convicted.
The boy's lawyer, Baris Ispir, had submitted a petition for his release to the court, together with around 100 colleagues who came from Istanbul in a show of support.
His arrest came amid growing concerns about freedom of speech in Turkey under Erdogan following raids earlier this month on opposition media linked to the president's top foe, exiled cleric Fethullah Gulen.
But Prime Minister Ahmet Davutoglu had supported the court's original decision to arrest the boy, saying: "Everyone must respect the office of president whoever he is."