A thief who was preparing to blow up an ATM has pulled a homeless man to safety after the vagrant wandered into the blast zone.

CCTV camera from the convenience store in Sao Paulo, Brazil, captured the moment a gang of thieves stormed into the shop and wired up the ATM.

Clad in hoodies and helmets, two of the bandits can be seen fiddling with the front of the ATM for several seconds while another thief empties the register.

The group then burst out onto the street and begin to run off before one of the thugs' spots a homeless man wandering past the blast zone.

At first, after appearing to yell at the man the thief then runs towards him and grabs him by the scruff of the neck before pulling him in the opposite direction.

Seconds later, the bomb explodes.

Thankfully, both men manage to escape harm.