Cellphone video shot by a bystander captured part of a shooting in which a California officer shot and killed an ex-con who police say had pulled a gun from his pocket.

It happened Thursday night in San Bernardino in the parking lot of a liquor store.

Police identified the man killed as Mark Matthew Bender Jr., a 35-year-old San Bernardino resident. They said his lengthy rap sheet includes an arrest for attempted murder.

Police released the video, which is nine seconds long, on Friday.

CHICAGO-AREA PRESS CONFERENCE AFTER BLACK TEEN KILLED IN POLICE SHOOTING DERAILED BY HECKLERS, PROTESTERS

It shows the uniformed officer wrestling Bender to the ground and yelling, “Stop fighting, dude.”

As the struggle continues, Bender on the ground can be seen reaching for an item in his waistband.

As both men get back on their feet, the officer is then seen drawing his weapon and firing four shots.

In describing the struggle, police spokesman Sgt. John Echevarria said Bender "was able to physically overpower the officer and retrieved a weapon from his pocket."

LA POLICE-INVOLVED SHOOTINGS LEAVE 2 DEAD, 1 WOUNDED

"At this time an officer-involved shooting occurred," he said.

The Los Angeles Times quoted Ecehvarria as saying that when the officer saw that Bender had a weapon, "He defended himself with his firearm.”

Echevarria said a 9 mm semi-automatic handgun was recovered at the scene.

The officer had responded to the liquor store for a report of a man with a gun acting erratically, jumping on top of parked vehicles, Fox 11 Los Angeles.

At a news conference Friday morning, police sought to portray Bender as physically intimidating, describing him as 6-foot, 3 and 300 pounds -- and cataloging what they called his “lengthy criminal past,” the Times reported.

CLICK HERE TO GET THE FOX NEWS APP

That prompted one individual to remark, “What does that have to do with him being murdered?”