Three masked robbers were caught trying to steal a cash machine from a post office when it got stuck in a doorway.
The men burst into the post office in Gorton, Manchester, and tied a strap around the cash machine which was attached to a stolen car outside.
CCTV footage showed the machine getting stuck as it was dragged against the door frame, before the robbers ran off.
The men were jailed at Manchester Crown Court after pleading guilty to attempted robbery.
Karl Warburton, 30, Wayne Horrocks, 20, and Mark Delahunt, 30, all of no fixed abode, admitted the charges at an earlier hearing.
Police said at about 1145 BST on 12 July the men reversed a stolen black Vauxhall Astra up to the front of the Mount Road Post Office in Gorton.
Two masked men got out, one of them carrying a breeze block.
The two men burst into the Post Office, one wedging the door open with the breeze block while the other tied a grey strap around the cash machine.
The strap was attached to the stolen car. As the car tried to drive off, the machine got stuck and the car wheels locked, causing them to spin around on the spot.
The men ran off but were caught by police shortly afterwards.
Det Con David Meeney, from Greater Manchester Police, said: "These three men had clearly planned this robbery in advance but what they did not think through was how difficult it is to dislodge a cash machine, or how relentlessly our officers would pursue them.
"Thanks to the rapid response of our officers, combined with their knowledge of the area and their sheer determination, we were able to lock up three dangerous men and secure so much evidence that they had no choice but to plead guilty to what they had done."