The boy, Mehmet Emin Altunses, was released following a complaint by his lawyer over his arrest in the central city of Konya.
He was met by his parents as he left the main courthouse building in the city but defiantly declared his political activism would continue, the CNN-Turk channel reported.
“There is no question of taking a step back from our path, we will continue along this road,” he said as he was released.
Altunses had delivered a speech on Wednesday in Konya, a bastion of the ruling Islamic-rooted Justice and Development Party (AKP), where he 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.
Altunses had accused Erdogan of being the “chief of theft, bribery and corruption”.
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 legal team had also pointed out that accusations against Erdogan and his inner circle have been circulating for months on social media without any action being taken.
– ‘Should be at school, not prison’ –
The boy’s mother, an unemployed cook, expressed shock over the arrest, saying he had been detained “as if he were an armed terrorist”.
“He is only a boy, his place is in school and not the prison,” Nazmiye Gok told the Hurriyet daily.
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.
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.”
Sezgin Tanrikulu, vice president of the main opposition Republican People’s Party (CHP), wrote on Twitter that the release would do nothing to change “the miserable situation in which our democracy finds itself”.
The authorities are hugely sensitive to allegations of corruption following sensational claims against key government members and Erdogan’s inner circle that broke in December last year.
Four cabinet ministers resigned but Erdogan accused the US-based Gulen of concocting the graft scandal and spreading leaks in social media to topple his government.
Erdogan has vowed no mercy in the fight against Gulen and the authorities have over the last year effectively purged the police force and judiciary to rid them of pro-Gulenist elements.
Thirty police, journalists and scriptwriters were arrested earlier this month in the latest of a string of raids that have provoked a major rift with the European Union, which Turkey hopes one day to join.
A court also issued an arrest warrant for Gulen himself although there appears for now little chance of his extradition from the US. -AFP