classroom projector
The teacher was left red-faced after discovering porn videos he had been viewing were streamed to the classroom projector Flickr/Eltpics

A teacher who inadvertently showed porn to his Year 8 class for 50 minutes on a classroom projector has lost an appeal against his dismissal.

The man, who has not been named, believed he was viewing the adult videos in private while pupils at a religious school in the city of Badajoz, Spain, took an exam. But he failed to realise his computer was still connected to the classroom projector and could be viewed by the students.

Some 28 students, aged 12 to 13, watched on as porn videos and sexually explicit online chats were streamed to the projector.

It was only after some 50 minutes that the experienced teacher of 20 years realised what had happened and quickly deleted his internet history, according to Spanish newspaper Hoy. He reportedly then went to the school headmaster's office and told him something "horrible" had happened.

The incident, which took place in February 2014 at the semi-private school Sagrado Corazón de Don Benito, saw the teacher sacked two months later following an investigation. A subsequent court appearance cleared him of corruption of minors.

This week a court ruled against him after he lodged an appeal against his dismissal, according to Hoy. It saw him blame his behaviour on "traumatic childhood experiences", a claim thrown out by the court.

A judge ruled the grounds for his dismissal were appropriate given the "highly sexual and pornographic" content viewed by children.