A former RAF serviceman became a voyeur and sex offender to cope with a mid-life crisis and work stress, York magistrates heard.

Michael William Bentley, 51, adapted a bag so that he could use a camera inside it to covertly video up women's skirts without their permission in Museum Gardens and in Boots in York city centre, Mike Hammond, prosecuting, said. Bentley had already taken similar videos in London.

Police later found nearly 2,000 extreme pornographic pictures and videos on his home computer.

Colin Byrne, mitigating, said about Bentley's explanation for his offences: "He talks about having a mid-life crisis, he talks about his life being slow, he talks about stress at work."

Bentley had been "almost relieved" when he was arrested on August 21, 2012, and had since undergone counselling and treatment to deal with his "sexual addiction", he said.

Bentley, now of St Paul's Mews, off Holgate Road, York, pleaded guilty to six charges of outraging public decency and eight of possessing extreme pornography, and was given a community order with 12 months' supervision and 90 hours' unpaid work.

He must also pay £85 prosecution costs and a £60 statutory surcharge. He was not put on the sex offenders' register because of the nature of the offences and the type of sentence.

Mr Hammond said a security guard at Boots became suspicious when he saw Bentley approaching women from behind and called police who arrested him.

Bentley had stopped off in York for two hours on August 21, 2012, en route from his then home in Lincoln to Scotland and had gone to the Museum Gardens and Boots to make the illegal films. He had viewed some of the ones he had made in London for his own sexual gratification.

Mr Byrne said Bentley was not charged until March this year and was on bail for 19 months while police analysed his computer.

During that time he had not re-offended.

His crimes had occurred when he was isolated, the court heard. Since then, the stress at work had eased and he was rebuilding his personal life.

In the past he had been in the RAF and he had also been with the charity Wateraid.