The 43-year-old tried to rob a family home in the west German town of Bonn, police said in a press release.
Having failed to break open the front door, the man clambered over a garden gate and entered the house through a set of patio doors, police reported.
During his raid he grabbed a Notebook and mobile phone, as well as some snacks for the journey home.
Not content with this haul, he then made for the storeroom.
But when he got there the doors slammed shut behind him – and due to a fault, could not be opened from inside.
After desperate attempts to free himself, the man finally called the police to come to his aid.
Officers rescued the sheepish burglar from the storeroom, before arresting him.
The man is already known to police in connection with past burglaries.
After officers had finished their inquiries, he was released in agreement with Bonn state prosecution. An investigation into the incident continues.