An Egyptian court convicted four Coptic Christian teenagers for contempt of Islam on Thursday, after they appeared in a video mocking Muslim prayers, sentencing three to five years in prison and referring a fourth to a juvenile detention facility, one

The harsh ruling -- which has followed a surge of blasphemy cases in Egyptian courts -- underscores what rights groups describe as a culture of intolerance within the country's judicial system at a time when the Egyptian President Abdel-Fattah el-Sissi is seeking to position himself as an advocate for religious reform.

The 30-second video showed the students pretending to pray, with one kneeling on the floor while reciting Qur'anic verses and two others standing behind him and laughing. One waved his hand under a second's neck in a sign of beheading.  The video was filmed during a students' picnic to mock Islamic State group it beheaded Coptic Christians in Libya last year.

It was filmed on a mobile phone by the students' teacher, who is also a Christian, and who was sentenced to three years in prison for insulting Islam in a separate trial.

The teenagers' lawyer Maher Naguib said his clients, who are high school students in the southern province of Minya, were tried in absentia. They were all minors, he said, adding that the court exempted only one, named Clinton Magdy, and referred him to the juvenile facility.

Some ten security trucks surrounded the court building in the southern city of Bani Mazar. The families of the students cried, and some women wailed in disbelief and collapsed on hearing the verdict.

Naguib described the ruling as "unbelievable" and said the judge should have just punished the teenagers with a fine.

Iman Girgis, a mother of one of the convicted students, 16-year-old Moller Atef, told The Associated Press, "my son was sentenced to five years for laughing. Is that possible?"

"What kind of justice is this?" she added.

Naguib said the video came to light in April 2015, shortly after Islamic State militants in Libya beheaded dozens of Egyptian Christians. The video prompted calls by angry Muslims to evict the students and the teacher from their village. Mobs attacked the students' houses in the village and security forces arrested the students while the teacher and his family were ordered to leave the village after a meeting of the village elders.

Christians make up approximately 10 percent of Egypt's population. They have long complained of discrimination by the Muslim majority. Christians were among the main supporters of the army chief-turned-president, Abdel-Fattah el-Sissi, who led the military ouster of Islamist President Mohammed Morsi amid mass protests against Morsi's rule.

"I voted for el-Sissi against Islamists," Girgis said, "is this the price?"

El-Sissi has vowed to purge extremism from Egypt's religious discourse, yet Egypt has witnessed a spike in blasphemy charges even after the ouster of Morsi, who hails from the country's largest Islamist group, the Muslim Brotherhood. Rights groups, including Human Rights Watch, have called on Egyptian authorities to end prosecutions based on contempt of religion laws.

The Egyptian Initiative For Personal Rights said that it documented nine such cases in 2015 alone, in which courts handed out sentences against 12 defendants, including Muslims and atheists. It said that another 14 citizens are currently under investigation for contempt of religion.

The ruling against the teenagers comes two days after an online activist Mustafa Abdel-Nabi was sentenced to three years in absentia for postings on his Facebook page that were deemed to be "degrading to God."

A female writer, Fatma Naoot, was sentenced to three years in prison in January after she was found guilty of contempt for Islam over a Facebook post criticizing the slaughter of animals for the Muslim feast of Eid al-Adha. She has appealed the ruling.

Last December, a court of appeals confirmed a prison term for a TV host and researcher, Islam Behery, who was convicted of "defaming religious symbols" and Muslim scholars after he called for the removal of passages from religious texts which he said supported extremism. The court in December reduced his prison term to one year from an initial five-year sentence.

EIPR said in a statement Thursday that the prosecutors are using vague terms such as "protection of religions, general system, and public morals" as a pretext to "impose restrictions on the mother of all freedoms: freedom of expression and faith."