A robber's clumsy pursuit of cash left him staring at the barrel of his own shotgun after he set it on the convenience store counter and the clerk snatched it up, officials said.

A surveillance video captured the man in sunglasses and a hooded sweat shirt, stuffing money from the register into his pockets, leaving his gun unattended early Tuesday.

That's when Quail Street News clerk Hafiz Alam grabbed the weapon by the barrel, quickly turned it around and pointed it at the man, who dashed out.

• Click here to visit FOXNews.com's Crime Center.

Seconds later, robber rushed back into the store and leapt over the counter. Alam and the suspect, Justin Walker, struggled over the gun off camera. The gun went off, but neither man was injured.

The robber drove off, but not before a truck driver took down his license plate number.

Police said they tracked the suspect to an Albany apartment, where they launched tear gas inside and got the 22-year-old to surrender. Walker was arrested and charged with robbery.

Visit FOXNews.com's Crime Center for complete coverage.