A bungling shop raider fell from a roof after a contraption he built to get away collapsed underneath him.
Stephen Skinnider tried to climb out of the Fife shop with his booty of £3,830-worth of cigarettes and tobacco.
The trolley, upon which he had piled a milk cage and a set of ladders, slid away and he tumbled to the ground.
Skinnider, 40, succeeded on his second attempt but his escapades were caught on CCTV and he was recognised by police.
The recovering drug addict admitted breaking into Mountfleurie Mini Market in Leven on March 8 and stealing cigarettes and alcohol.
He is already serving a prison sentence in Perth but was jailed for a further 14 months when he appeared at Kirkcaldy Sheriff Court on Tuesday.
His “farcical” antics in the middle of the night provoked laughter on the public benches as the court heard about the raid.
Skinnider had broken in through the flat roof of the shop owned by Muhammed Saeed in Mountfleurie Street, using a ladder.
Ms Bremner said: “CCTV footage was reviewed and it shows the accused falling in through the roof, turning the lights on, and removing a considerable amount of cigarettes, before attempting to leave again through the hole in the roof with four carrier bags of stolen goods.
“He was seen on CCTV to manoeuvre a shopping trolley under the hole in the roof, place a metal milk cage in the trolley, and thereafter put a set of small ladders on top of this to climb out.
“The CCTV shows the trolley sliding away, as it wouldn’t even take his weight.
“He did managed to escape from the roof on the second attempt, but he was identified by the police officers from the CCTV.”
His solicitor David Cranston described how he built the pyramid of items from the shop on a trolley to make his getaway, before “crashing” to the ground as he tried to clamber out.
He said: “It was as badly planned as it sounds.
“He doesn’t recall exactly how he got back up the roof.”
He was traced at his partner’s home nearby.
Mr Cranston said Skinnider, of Stanmore Place, Leven, who had a long term drug habit, had taken Valium and remembered little of the offence.
Sheriff Grant McCulloch told Skinnider there was “not a lot I can say really”.
He said: “You have a lengthy record for crimes of dishonesty, including housebreaking, theft by opening lockfast places and so on.
“The fact this is said to be a comical, farcical event is really neither here nor there.
“It certainly wouldn’t have been comical or farcical to the shopkeeper to discover what happened to his shop by the amount of damage and by the amount of theft.
“Only a custodial sentence is appropriate.”
Damage caused to the premises was valued at around £5,000. About £200 of bread and rolls were crushed when Skinnider fell.