Girolamo Albanese, 56, and 54-year-old Maurizio Scerbo were arrested this week and charged with the robbery last May in Sanremo, north-west Italy.
The pair allegedly broke into the city’s Palace of Justice one night and stepped a carefully-planned path to the courthouse bar, picking up water bottles, before tiptoeing to the ATM, La Stampa reported.
They then reportedly used a blowtorch to break into the ATM, using the water to cool it down before getting their hands on the cash.
But the thieves “committed some fatal errors”, Public Prosecutor Roberto Cavallone was quoted in La Stampa as saying.
They wore thick gloves and so left no fingerprints on the ATM, but the thirsty work led them to drink from the water bottles which they discarded at the crime scene.
Investigators were then able to take DNA samples from the bottles, matching one to a glove found outside the courthouse, the newspaper reported.
The final breakthrough came when police traced a car from CCTV footage outside the courthouse. Marrying the evidence together led them this week to Albanese and Scerbo, although the hunt continues for the third thief and mastermind of the break-in, La Stampa said.