Authorities released Friday the Turkish high school student arrested on charges of insulting President Tayyip Erdogan pending trial but could still face up to four years in prison if convicted, local media reported. The 16-year-old was arrested after he read out a statement criticising the ruling AK Party and Erdogan personally over corruption allegations during a ceremony last week to commemorate the killing of a Turkish soldier by Islamists in the 1920s. Turkey's penal code forbids insulting the president, but the boy's arrest sparked fierce criticism among Erdogan's opponents, who accused him of growing increasingly authoritarian and intolerant of dissent. A court in the city of Konya ruled in favour of an appeal submitted by the teenager's lawyers on Thursday asking for his release, Dogan News Agency and several newspapers reported. Kemal Kilicdaroglu, the head of Turkey's main opposition party, welcomed the boy's release. "It is not right for a 16-year old to stay in jail even for a minute. It is a good thing that a mistake is rectified, although belatedly," he said. It was unclear when the teenager would face trial.