A sex offender indecently assaulted a girl at a train station when he was supposed to be under supervision.
Kevin Bowler, 40, was being held under the Mental Health Act when the incident happened at Watford Junction.
At Watford Magistrates' Court on Thursday Bowler admitted indecently assaulting the girl in July last year.
Hertfordshire Partnership NHS Trust, which runs the unit where he was being detained, apologised for the distress caused to the victim.
They said procedures had since been tightened.
The court heard Bowler was out on a series of accompanied visits, but had managed to get away from his escort who was making inquires about trains.
Magistrates ordered that Bowler should continue to be detained at the unit where he currently lives.