A North Yorkshire man secretly filmed a woman on the toilet because he felt “horny” and thought it was a “good idea”.

When the woman learnt what Andrew Simpson had done, she told police “It made her feel disgusted, it was gross, it made me feel dirty", said Megan King, prosecuting.

Today the 52-year-old man with no previous convictions is subject to a suspended prison sentence, on the sex offenders’ register and has to tell police if he owns anything capable of filming or taking photos including mobile phones.

Defence solicitor Kevin Blount said as soon as Simpson realised that his secret filming had been discovered, he had immediately emailed the police and his employers to tell them what he had done and to apologise.

“He has held a job with the same company for 12 years, a good job, a responsible job, a well-paid job,” said the solicitor.

He still had the job, though he would lose it if he was sent to jail.

Simpson, of Kingfisher Drive, Pickering, pleaded guilty to voyeurism.

Magistrates told him: “We find the offence was so serious only a custodial sentence can be justified.”

They gave him a 17-week prison sentence suspended for 18 months on condition he does 15 days’ rehabilitative activities and made him subject to a sexual harm prevention order which bans him from having any form of covert filming device.

He must also tell the police about any device he has that can be used for taking pictures or films.

The order lasts for seven years, the same length of time that he will be on the sex offenders’ register.

Mr Blount said Simpson was remorseful and had apologised for his actions.

Ms King said Simpson told police he had been feeling “horny” when he set up the covert camera and it had “seemed a good idea to film people on the toilet”.

He had used a camera disguised as a pen for his covert filming.

Mr Blount said Simpson had never been in trouble with the police before. At the time, he had been drinking heavily, getting through two and a half bottles of whisky a week, and he accepted alcohol had played a part in his decision to set up the covert camera.

But since then, he had cut his drinking considerably to four beers at the weekend and got his alcohol intake back under control.

Simpson had been diagnosed as having autism that affected how he understood social clues, the court heard.