A military veteran working as a clerk at a Bay Point market fatally shot an armed robbery suspect late Sunday night after being pistol-whipped in a violent attack caught on camera.

Mark Kasprowicz was working behind the counter at Kam's Market around 11 p.m. when two masked suspects entered the business. One suspect went to the back of the market and held an employee at gunpoint while the other suspect — armed with a semi-automatic handgun — went behind the counter, pistol-whipped Kasprowicz and started pulling cash out of a register.

"At first I thought it was a joke," Kasprowicz said. "Two seconds later, I realized it was real. He pushed me to the ground, to my knees and everything."

When Kasprowicz reached for a gun in a drawer next to the register, the suspect attacked him again and the two struggled over the gun. As they wrestled on the ground, the suspect's gun went off. The suspect immediately took off running and Kasprowicz opened fire.

"I just looked around, and he was running, and just by instinct, I let go a shot," Kasprowicz said. "I managed to squeeze off one round, and apparently after the fact I found out that I actually hit him."

Exclusive video at this hour on @nbcbayarea: A retired Air Force veteran shoots and kills an East Bay robbery suspect - and another gunman in the holdup is on the run. Live reports on Today In The Bay every half hour starting at 5 - streaming at https://t.co/3w0gJl7DlU pic.twitter.com/86q0o6uqVR — Thom Jensen (@ThomJInTheBay) December 23, 2019

Both suspects managed to run out of the market, but the suspect who attacked Kasprowicz died in the parking lot outside the store, according to the store owner. The other suspect got away.

Kasprowicz is an Air Force veteran with two decades in private security. He said his military training and experience as a security guard kicked in when he was attacked.

"After I realized that everything was real, having a big handgun pointed at you, there's only one thing that you worry about: your own life," Kasprowicz said.

Kasprowicz went to the hospital where he had to get 12 staples in his head, but he is expected to be OK.

"My adrenaline is still pumped up a little, but other than that, I'm not too bad," Kasprowicz said.

Kasprowicz's family is on edge, but just glad he survived and that his coworker is unharmed.

It turns out the store has a history of chasing away robbers -- the owner's dad did it more than once. And now, they said thieves usually leave them alone.

Contra Costa County Sheriff's Office deputies said Kasprowicz acted in self defense. Deputies are now looking for the other robber who survived and still on the loose.