Criminals may think they’re deserving of what other people have, but the only thing they actually deserve is a rich helping of karma. And that’s what one thug learned the hard way when he made the huge mistake of trying to rob a cop.

The security footage comes from Brazil, where a robber had the brilliant idea of holding people up with a gun and forcing them to empty out their bank accounts. He wasn’t counting on one of his victim’s being armed, too.

The robber approaches a man, holding a gun, and demanded that he withdraw cash from the ATM. The man he tried to rip off was a military police officer, well-trained and armed. So he waited until he had a good opportunity to strike, and as soon as the mugger was distracted, he swung into action. He used his gun and shot the toolbag trying to rob him.

So you see, there are two valuable lessons to be learned here. First, don’t assume that if you’re going to rob someone, they’ll be helpless and won’t fight back. Second, carrying a weapon that you’re well-trained in how to use is invaluable, and everyone needs to do it.