Prosecuting, Jim Clare said McGarry, who was riding a bicycle, approached the woman on the Spa Trail at 4.50pm on March 31 and as he passed her, he dropped a glove, which she picked up and returned to him.

He then said to her: “I’ve got a bet on with my friends to do something outrageous this weekend, there’s £60 for you,” and he held some money up before saying “Can I smell your bum?”

Mr Clare said McGarry then rode off but the woman saw him later, also on the trail, and could see that he was masturbating.

She called the police and walked on but then later again saw him, this time on his bicycle and that he still had his penis in his hand and was masturbating.

Mr Clare said McGarry was arrested and when interviewed had agreed with everything his victim had said, although he said on the last occasion he had his hand over his groin but was not masturbating.

He told police he ‘didn’t care what people thought or if they saw his penis’.

In a victim’s statement, the woman said she had been ‘genuinely disgusted’, that she would ‘never forget what happened’ and that she now walked in busy areas rather than remote ones’.

Mitigating, Anita Toal said McGarry felt ‘ashamed and terrified’ about what might happen as a result of what he had done.

She said McGarry had a degree in politics but had dropped out of a teacher training course because of stress, and had been ‘going downhill ever since’.

She said he had not been to a GP but was showing all the classic signs of depression.

Ms Toal said that although McGarry did not normally take drugs, he had been given ketamine on that day by a friend, and he had taken some before committing the offence.

She said that although at the time of the offence he told police he had no empathy for the victim, he did now.

She said he was unemployed and living with his parents, but was going to Prague later in May to train to teach English to foreign adults.

She said the offence was ‘inexplicable and totally out of character’ and that there was no indication McGarry had ‘targeted the victim’.

“She was sadly in the wrong place at the wrong time,” she said.

Barbara Newman, for the Probation Service, said they believed it was a ‘one-off incident’ and that he posed a ‘low risk’ of re-offending.

The magistrates said they took the offence’ very seriously’ and had considered sending him to prison but they imposed a three year conditional discharge and ordered him to pay £500 compensation to the victim.

He was also ordered to pay £85 in costs and they advised him to seek help from his GP before he left the country, and told him ‘this could affect your whole life’.