A bank thief helped get himself caught after he blew some of his money on a luxury holiday days after the raid.
Russell Snowdon, 42, joined an accomplice to blow up a cash machine at the Royal Bank of Scotland branch in Langholm last November.
A stolen Land Rover was used as a getaway but a resident snapped it on his iPad before it left the scene.
Snowdon was remanded in custody at the High Court in Glasgow prior to sentencing.
A judge heard how following the raid he paid almost £1,700 in cash for a two-week trip to Gambia with his partner.
When staff at the English-based travel agent remarked the bank notes were all Scottish, he claimed he had just sold a car there.
However, Snowdon was later caught for the raid and held shortly after he arrived back in the UK from his holidays.
It emerged in court he was already a convicted killer having been jailed for manslaughter in 2001.
He now faces another spell behind bars after he pled guilty to a number of charges including stealing £45,080 from the RBS.
Snowdon, who latterly lived in Crook, County Durham, will learn his fate later this month.
The High Court in Glasgow heard how residents were awoken by a loud bang at about 01:40 on 11 November.
One mother and daughter – who lived above the bank – initially thought there had been a car accident.
But, instead, CCTV played in court showed an explosion had occurred at the RBS with the ATM being blasted open.
A figure was then seen climbing through a broken window, removing bundles of cash and handing it to his accomplice outside.
Prosecutor Tim Niven Smith said it was under two minutes from the explosion to the man inside the RBS leaving.
Police were soon on the scene and it emerged a stolen Land Rover had been used in the raid.
The court heard a resident had tried to record what had happened on his tablet device.
Mr Niven Smith: “He attempted to film what was occurring on his iPad… he was able to film the registration of the Land Rover.”
The vehicle was later discovered burnt out with gas canisters nearby.
Snowdon later came under suspicion and it emerged he had left the country days after the raid.
The court heard he was “enjoying a holiday” in Gambia having only booked the trip on 14 November. He paid £1,663 in cash for a two-week trip.
Mr Niven Smith said: “The travel agent had made a remark about the Scottish notes being unusual and Snowdon said he had sold a car in Scotland recently.”
He was later held at Manchester Airport on his return on 3 December.
It also emerged his DNA linked him to a lighter, screwdriver and blood spot found at the bank.
The court was told the blast was caused by the “ignition of a flammable gas and air mixture”.
It was said the front of the ATM was likely prised open with a screwdriver before a tube was inserted allowing “compressed gases from cylinders” to cause an explosion.
Nearly £9,000 of the stolen cash was recovered having been left at the scene.