A sex pervert scared an 11-year-old schoolgirl after entering a female toilet in Droitwich.

David Marshall brushed the victim's face with a pair of turquoise pants by holding them over a cubicle wall.

He then tried to push his way into the cubicle and knocked the child's hand away as she attempted to keep the door shut, said Peter Parson, prosecuting.

He ran off when the girl began screaming but was caught with the help of witnesses.

Marshall, 27, of The Tyning, Droitwich, pleaded guilty to assault by beating and outraging public decency.

He had two previous convictions for indecent assaults in an underpass and a conviction for harassment by giving out sexual messages in anonymous phone calls, Worcester Crown Court heard.

Judge Andrew Plunkett said his primary concern was the protection of the public in the future.

If Marshall was jailed for the maxmium sentence of two years, he would not get any treatment for his "sexual problems".

The judge gave him a three-year community order after hearing he had spent 70 days in custody.

Under the order, Marshall must complete a sex offenders' group work programme and have his progress reviewed by a judge once a month.

Marshall was warned that any breach would result in a two-year jail term.

The judge also praised the victim's "presence of mind" by screaming when confronted by a stranger.

She had gone into the toilets in St Andrew's Square, Droitwich, on May 30 while out shopping with her father.

Defence counsel Charles Hamer said Marshall's problems had never been properly addressed in the past.

He knew his actions were wrong, was ashamed of them and appreciated that the girl was frightened and upset.

The judge made a Sexual Offences Prevention Order banning Marshall from having contact with children under the age of 16.