Turkish authorities have released a teenage boy who was arrested for allegedly insulting President Recep Tayyip Erdogan.

The 16-year-old was embraced by his mother on Friday as he walked out of the detention center in the central city of Konya.

Turkey Frees Teen Who 'Insulted' Erdogan

At a student protest on Wednesday, the boy gave a speech during which he accused Erdogan of corruption.

Turkey Frees Teen Who 'Insulted' Erdogan

Prime Minister Ahmet Davutoglu had defended the arrest, saying no one should be able to disrespect the president's office. But the case prompted an outcry from lawyers, dozens of whom traveled to Konya from around the country to show their support.

Turkey Frees Teen Who 'Insulted' Erdogan

Although the boy was released at the order of a court, he still faces up to four years in prison if he is charged and convicted.

Erdogan was prime minister of Turkey for 11 years before being elected to the presidency in August. His critics accuse him of improperly expanding presidential powers and overseeing a crackdown of freedom of speech.