ISTANBUL : A Turkish court sentenced a teacher to 508 years in jail on Wednesday, after convicting him of sexually abusing children at guesthouses run by Islamic foundations, the Anatolia news agency said.

Muharrem Buyukturk, 54, was charged with sexually abusing 10 children in the case, which hit the headlines when he was arrested last month and sparked a political scandal after secularists accused the government of defending the organisations.

The heavy sentence will be seen by some as an iron-fisted response by the justice system to allegations that such foundations serve as illegal guesthouses for minors. Buyukturk had been teaching private courses at apartments rented out by the Ensar and Kaimder charitable foundations in the conservative Anatolian town of Karaman, when reports emerged of abuse committed between 2012 and 2015.

He was given 508 years and three months for molesting children aged between 12 and 14, and encouraging them to watch obscene images, with victims testifying that they had been made to watch pornography involving animals. Buyukturk denied the charges.

“I did not do it. Police pressured me saying ‘if you say this you will not be punished’, so I told them.

But I am innocent,” he reportedly told the court during his one-day, closed-door trial. “Those children were alone for six months. They had sexual intercourse between themselves,” he said, adding that he “lay alongside the children” during their exam period in order to console them, the Dogan news agency said.

Officials in Karaman prevented journalists from attending the trial, banning all press briefings, gatherings or rallies during the proceedings in which Buyukturk testified from jail via video-link. The young victims had already testified to the Karaman Court of Serious Crimes in pre-trial sessions, reports said.

President Recep Tayyip Erdogan and the ruling Islamist-rooted AKP have come under fire for trying to protect the foundations, prompting the firebrand leader to denounce his opponents as “political perverts”. Prime Minister Ahmet Davutoglu also joined in, accusing the opposition chief of being “inhumane”, but promised anyone found guilty of the abuse would be held to account. Rights groups had slammed the trial, saying the foundations should be held to account and heads should roll.