A burglar left hanging upside down when his leg got jammed in a window called the fire service to come to his rescue.
Frederick Moulton, 53, became trapped as he tried to enter an empty property in Swindon on Wednesday.
He was arrested after he was forced to call the emergency services, Wiltshire Police said.
At Swindon Magistrates’ Court. he pleaded guilty to burglary and possession of a Class B drug and was handed an 18-month community order.
A force spokesman said officers attended the call alongside firefighters.
“On arrival it was obvious that Frederick Moulton was trying to break in”, he said.
He added that Moulton was also ordered to pay a £95 victim surcharge as well as prosecution costs of £85.