A pistol-packing customer shot two robbers who tried to stick up a convenience store in Virginia, killing one suspect and seriously wounding another, police said.

The shooting broke out at a 7-Eleven in Virginia Beach early Thursday when two armed males wearing masks walked into the store and demanded money. A man in the store with a legal gun then “confronted and ultimately shot” the suspects. A third man was also later arrested outside the 7-Eleven, Virginia Beach police said in a statement.

The quick-thinking hero was not identified by police and had not been charged in connection to the shooting as of Friday, police spokeswoman Tonya Pierce told The Post.

Pierce declined to discuss the bystander’s response, but another customer inside the store told The Virginian-Pilot that he sprang into action after being targeted by one of the suspects.

“Two gentlemen – armed, masked robbers – came in the store with their guns up and told us to stay where we were, nobody move,” witness Barrie Engel told the newspaper. “I did exactly that. I pretty much froze and looked at my friend and he looked at me wondering, ‘Is this really happening? Is this real?’”

As one masked suspect stood near the door, the other rifled through a cash register and stuffed cash in his pockets, Engel recalled. Then, as the clerk raised his hands and pleaded with one suspect not to shoot, a series of gunshots rang out, she said.

The shooter then stood beside Engel and her friend before telling her, “Nobody’s gonna point a gun at me and get away with it,” Engel told the newspaper.

Police identified the man who died during the confrontation as Michael Moore, 18. Also charged in the botched robbery were Ronald Lee Brookins Jr., 18, of Suffolk, and Deric Breon Simmons, 19, of Chesapeake, police said.

Brookins has been charged with abduction, wearing a mask in public, use of a firearm in the commission of a felony and conspiracy to commit a felony. Simmons is facing two counts of robbery and gun charges. Both remain held in custody without bond Friday, online records show.

Pierce said the three men are believed to be responsible for robbing four other 7-Eleven stores in the area, including locations in Norfolk and Newport News.