A convenience store clerk shot and killed an assailant who assaulted and pistol whipped him during a violent robbery Sunday night in Bay Point — a harrowing attack that was captured on video, officials said.

Kamal Sandhu, owner of Kam’s Market on Port Chicago Highway, said two men entered the store around 11 p.m. with the intention of robbing the place. One of the men pistol-whipped a cashier and held the employee at gunpoint while rifling through the cash register.

“They had a little struggle,” Sandhu said.

In video footage from a camera facing the counter, two men — one dressed in a black sweater with his face covered by a cloth and dark sunglasses; the other wearing a blue jacket, a green hoodie and a backpack — walk into the store from the front entrance and go in separate directions.

Now Playing:

The store clerk, putting away money behind the counter, glances at the men but remains focused on his work. The man in black keeps walking before crouching near the end of the counter.

Four seconds later, he approaches the clerk, pointing a gun from his waist. He grabs the clerk and pulls him out of the way before smacking him in the head with the gun. The clerk falls to the ground and the man grabs a stack of bills.

The clerk’s hand reaches for the register, but the man pushes him down as he grabs what appears to be a yellow bin. The thief starts snatching more cash from the register, placing it in the yellow bin, while the clerk puts his hand on his head where he was hit with the gun.

But in a moment the robber looks away, the clerk opens a drawer — blood now flowing from his head — where a gun can be seen. The thief spots him and hits the clerk again while trying to shut the drawer.

The men struggle for six seconds, at which point the thief gets a grasp of his gun and hits the clerk on the head two more times.

The second man who had walked into the store jets out the door.

The clerk stands up, makes eye contact with the thief who had just pistol-whipped him — the two each holding a gun — before the thief runs away without the bin of cash.

Another man runs to the clerk behind the counter, touches him on the back, picks up the gun, tucks it behind his pants and jogs out of the store.

Investigators later determined the clerk had shot his assailant during the attack, said Jimmy Lee, a spokesman for the Contra Costa County Sheriff’s Office.

Responding deputies found the robber suffering from a gunshot wound on the ground near the store at the intersection of Lynbrook Street and Desanie Way officials said.

He was pronounced dead at the scene. His identity was not immediately released.

Sheriff's Office investigating last night's incident in Bay Point. Will have more information later. We have not officially put anything out yet. — CoCo Sheriff PIO (@cocosopio) December 23, 2019

Alejandro Serrano is a San Francisco Chronicle staff writer. Email: alejandro.serrano@sfchronicle.com Twitter: @serrano_alej