A Turkish high school student arrested on charges of insulting President Recep Tayyip Erdogan was released on Friday 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 armed men 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.

Erdogan has accused his former ally, US-based cleric Fethullah Gulen, of seeking to undermine his rule by orchestrating a high-reaching corruption scandal that began a year ago.

The scandal posed one of the biggest challenges to his 11-year-rule as prime minister, prompting three members of his cabinet to quit and drawing international criticism for his response of tightening Internet controls and reassigning police, judges and prosecutors.

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.

Source: Reuters