Two off-duty D.C. police officers thwarted an armed man who tried to rob them Tuesday night at a gas station in Prince George’s County, authorities said.

The would-be robber approached two men who were pumping gas at a Sunoco station in the 4800 block of Kenilworth Avenue in Edmonston and the robber pulled out a knife and a can of mace, said Stephen E. Walker, chief of police in the town of Edmonston.

In response, the D.C. police officers pulled their service weapons.

No shots were fired and the officers apprehended the would-be robber as he tried to walk away. An Edmonston officer was patrolling the area and arrived at the gas station a short time later and took the man into custody.

The suspect was identified as Sandy Stancil, 51, of Hyattsville, Walker said. Stancil has been charged with attempted armed robbery.