Four charges related to the making and distribution of a total of 35 indecent photographs. The other two related to causing or inciting pornography.

The court was told that Gilliatt befriended the teenager to such an extent that he became “a father figure” to him.

Sarah Knight, prosecuting, said they helped to tinker with and repair each other’s cars and also watched porn films together.

“But then Gilliatt started coming on to him,” said Miss Knight. “Frequent remarks were made, aimed at challenging the 17-year-old’s sexuality.

“The 17-year-old deleted all the photos and messages because he didn’t want his girlfriend to see them. He said no repeatedly to the requests in the text messages, and he never sent any pictures in return. He was very upset when he saw the pictures of himself at work.”

In a statement read to the court, the teenager, who cannot be named for legal reasons, said: “Nigel was like a dad to me. He has devastated my trust.”

Dominic Shelley, mitigating, said: “This is an unusual case where a man of his years and character should have known better. Gilliatt is an ordinary, hard-working, industrious man. This will be the last time he offends in this way.”

Judge James Sampson read a pre-sentence report on Gilliatt by probation officers and also references from his wife and a friend.

He told him: “The references suggest you are highly thought of by your work colleagues, and have a loving wife.

“But the pre-sentence report suggests you are in denial and don’t realise the seriousness of these offences.

“You clearly had a sexual interest in your victim and caused him a high degree of emotional distress and anguish. He has been let down severely.

“You richly deserve to go to prison, and three years would be justified. But I am just persuaded to give you a chance.”

Gilliatt was sentenced to a community order for three years, and ordered to go on “an onerous” sex-offenders’ work programme. He was also banned from making any contact with his victim and placed on the sex offenders’ register for seven years.