A man got stuck in a window and damaged it when he tried to climb into his flat after he lost his key.
Stuart Dilnot was living at Calder House in Mirfield as part of his crown court bail conditions.
He broke a window at the converted Victorian house as he tried to wriggle his way free, Kirklees magistrates were told.
The 59-year-old appeared at the Huddersfield court via a video link from HMP Leeds.
Last month he was jailed for 27 months for performing an indecent act in front of a young girl and secretly filming her.
Prior to this he was living at the supported living property which is split into six flats and run by Stonham Home Group, which provides accommodation for defendants on bail.
Prosecutor Vanessa Jones told magistrates that on September 25 he returned to his ground floor flat following a night out drinking.
She said: “He misplaced or lost his key and went to the main door of the property with a bottle of alcohol in his hand trying to get in.
“He was unsuccessful and then tried to get through a side window.
“This attempt was rather rough and he broke the window, cutting his hand in the process.”
Dilnot was sentenced to the lengthy term of imprisonment at Leeds Crown Court last month.
He sexually assaulted a girl between August 2011 and 2013 while she was aged under 14.
Dilnot pleaded guilty to six counts of engaging in sexual activity in the presence of a child under 13, two counts of sexually assaulting a girl under 13, two counts of voyeurism and one count of indecent assault on a girl under the age of 13 or 14.
As well as his jail term he was placed on the sex offenders’ register for 10 years and given an indefinite sexual harm prevention order.
He pleaded guilty to criminal damage and his solicitor Jonathan Slawinski told magistrates: “He was living at the supported accommodation as part of his bail conditions.
“He’d been out, had a drink, misplaced his keys and could not get into the accommodation.
“He tried unsuccessfully to climb in through a laundry window adjacent to his room.
“Because of his size he couldn’t get through and broke the window as he tried to wriggle his way through it.
“His actions were reckless and he should have known better.
“Had he been in a sober way he never would have embarked on that course of action.”
Magistrates gave Dilnot a 12 month conditional discharge for the offence.
They ordered him to pay £200 compensation to Stoneham Housing.