A prolific flasher who exposed himself to two women in an alleyway near a girls' grammar school has been jailed for 16 months.
Gavin McDonald was subject to a community order - imposed for eight offences of exposure - when he committed a sex act in front of the women in January.
Maidstone Crown Court heard he was also on bail, having been charged with outraging public decency in August last year and for which he faces trial by magistrates next month.
McDonald was sentenced at Maidstone Crown Court
McDonald, of Midhurst Court, Mote Road, Maidstone, admitted two charges of exposure and was jailed for 10 months concurrent for each offence.
Judge Michael Carroll also revoked the community order, which he himself had imposed in June 2012, and re-sentenced the 29-year-old to a further six months consecutive, making a total of 16 months.
"Everything else has been tried," said the judge.
"Sending you to prison is a negative exercise but it will ensure you are not out in secluded alleyways, exposing yourself and masturbating in front of unaccompanied female persons."
Judge Carroll added that while he accepted McDonald had not targeted the women, it was not "by accident" that he was in the alleyway.
"It shows an intention to commit this kind of offence," he said.
McDonald, formerly of Doria Drive, Gravesend, denied being in breach of a sexual offences prevention order which banned him from going within 100m of Maidstone Grammar School for Girls.
This was accepted by the prosecution and the charge was ordered to be left on the court file.
Prosecutor John Fairhead said one victim was a landscape gardener while the other was a woman in her 70s, who had been left so shaken by the incident she did not think she could use the alleyway near Buckland Road again.
It was just after midday on January 3 that the first incident was reported to police.
"She (the gardener) said a man had got his penis out and was masturbating in front of her," said Mr Fairhead.
"He made a sexual comment as he went past, then wolf whistled at her."
CCTV cameras were alerted and followed McDonald to Jubilee Square in the town centre.
He was stopped by police and was said to have "spontaneously" told the officer he was on probation for indecent exposure.
However, McDonald ran off and the CCTV cameras saw him "jettison" his coat before running into the Chequers shopping centre through the underground car park.
The court heard he was eventually found in the mall toilets and a cubicle door had to be kicked open in order to arrest him.
"He made a sexual comment as he went past, then wolf whistled at her" - prosecutor John Fairhead
It was then discovered that a pensioner had also reported a man had exposed himself to her in the same alleyway that day. Again, he had got his penis out and committed a sex act.
The court heard that he had been jailed for 12 months in 2009 for offences including exposing himself to children.
Deborah Champion, defending, said these were the only type of crimes McDonald committed and "clearly" needed treatment.
However, Judge Carroll pointed out he had been placed on such a programme in the past but had failed to complete it.
"It is not right that someone who has been on a course and failed should take precedence over someone the court wishes to put on a course with a hope of success," he said.