A teacher at one of Britain’s most prestigious public schools had sex with a teenage pupil in his classroom, a misconduct panel heard.

Dr Dean Johnson, 52, a physics master at Charterhouse in Godalming, Surrey, revealed his fantasies in Facebook messages to the girl beforehand.

He also asked what her underwear size was before buying stockings and presenting them to her gift-wrapped.

The astronomy and astrophysics specialist, who joined the £36,000-a-year boarding school in 1997, is facing a teaching ban after the panel found the allegations proven.

It heard he resigned in 2013 when the relationship came to light, after the girl complained to police.

An investigation led to his conviction for possessing extreme pornography, which depicted a woman being hanged, in 2015. He has since taught abroad.

The National College for Teaching and Leadership panel heard the relationship became sexual weeks after the girl turned 18. She was still a sixth-form student and had been taught by Dr Johnson the year before.

Kayleigh Brooks, presenting the case, said: “Mr Johnson accepts the Facebook contact was inappropriate since they discussed topics such as sex and previous relationships.”

She said Charterhouse considered the conduct to be even more inappropriate because the girl had touched his leg under a table during a school meal in 2007, aged 17, to show she had a “crush” on him.

Ms Brooks said: “The college say it was inappropriate to engage with this pupil given the context of what had happened.”

The relationship continued for almost five years after the girl graduated, with Dr Johnson filming their sexual encounters.

After she reported him to police, this led to him being convicted at Guildford crown court in May 2015 for possessing 22  “perverted” films which enact scenes that would “threaten a person’s life”.

Ms Brooks said one showed a woman being “strangled half-naked, with a man with a cord around her neck ... and a woman being ... hanged while two men watched”.

Dr Johnson was given an eight-month prison sentence suspended for two years.

There is no suggestion pupils came into contact with the material, which was filmed by actors in the US.

This month the panel ruled that the conviction, and the relationship, meant that Dr Johnson had “breached teaching standards” and was guilty of unacceptable conduct which could bring the profession into disrepute.

It will shortly decide whether to recommend a ban to the Secretary of State for Education.

Ms Brooks told the panel it was Charterhouse’s belief that Dr Johnson, who was educated at Oxford and Cambridge, had shown the girl “inappropriate special attention” before the relationship started. She added: “Ultimately, he was the one in a position of trust.” 

Dr Johnson, a now-divorced father of three, told the panel he is a “fantastic teacher” who “can take subjects such as maths and physics and make them do it”.

He said: “There isn’t a day or waking hour where I don’t reflect on the consequences of this mistake.”

He admitted the allegations but argued that his conviction was “not relevant” to his fitness to teach. The panel ruled that it was relevant. 

Annie Railton, representing Dr Johnson, said the relationship with the teenager started because he was “effectively living apart from his wife” and felt “alone and isolated”.

She added: “Is it right the profession should lose such a dedicated, gifted, charismatic teacher for one catastrophic mistake?” Since his conviction, she said, he has been teaching abroad “with considerable success”.