A 42-year-old gay headteacher who was fired for having sex with two 17-year-old boys he met on Grindr has won a discrimination case against his former employer.

Matthew Aplin, the former principal at Tywyn Primary School in Neath Port Talbot, Wales, was found by a tribunal to have been discriminated against, reports The Telegraph.

The “openly gay” teacher of 19 years had arranged in August 2015 to meet with the two boys on the gay hookup site and the three of them had group sex. Social services and police uncovered the liaison days later, but it was determined there had been no criminal activity.

The school’s governors held a disciplinary hearing in May 2016 where they found Mr Aplin had undermined their trust and confidence in him with the investigating officer’s reporting claiming the headteacher was a potential danger to children.

Mr Aplin was fired as a result, challenged the decision, but resigned, taking the case to an employment tribunal on grounds he had been subjected to “unfair dismissal and sexual orientation discrimination.”

The Employment Appeals Tribunal (EAT) had ruled that Mr Aplin would have been treated differently had he been a heterosexual man caught having sex with two teenaged girls.