A California man threatened to shoot a police officer "right now" as the two men desperately grappled for control of a gun during a violent altercation Sunday that was caught on the cop's bodycam, police officials said.

The Sacramento Police Department said in a news release that Artavious Coleman, 33, was arrested after the "violent struggle," which happened around 2 a.m. Sunday and was captured by a bodycam.

Officers had originally tried to pull over Coleman for driving a vehicle that had an expired registration, but the 33-year-old at first didn't stop and then, when he did, Coleman exited the car and tried to run, authorities said.

LOUISIANA POLICE OFFICER DIES AFTER BEING SHOT MULTIPLE TIMES: REPORT

After a foot chase, one officer tackled Coleman, who was "combative, resistive and attempted to run away again," according to police.

Coleman got to his feet at one point, prompting the officer to warn Coleman he was going to be "tased."

"At this point, the officer heard a clicking sound and the suspect stated that he was going to “shoot” the officer," police said.

In the video released by the department, the man identified as Coleman can be heard saying, "I'm about to shoot your a--. I'm going to shoot you right now."

After the officer deployed a conducted energy device, Coleman fell to the ground. As the cop began trying to detain Coleman, he said he felt a gun in his hand.

"At that time, the officer realized that the clicking sound he had just heard was the sound of the trigger of a handgun being pulled by the suspect who had also stated that he was going to 'shoot' the officer," police said.

ILLINOIS POLICE OFFICER'S SCREAMS CAUGHT ON CAMERA DURING STRUGGLE WITH FUGITIVE BEFORE BACKUP SHOOTS HIM

A second, "violent struggle" then ensued as the officer pinned Coleman's hand and gun to the ground to prevent him from firing the gun. The officer's bodycam fell off during the brawl but continued to record.

"During the struggle for the gun, the suspect bit the officer on the wrist that was restraining the firearm," police said. "This violent fight, including the struggle over the suspect’s firearm, lasted for approximately a minute and a half until additional officers arrived."

Coleman was taken into custody, where a record check found a felony arrest warrant from another state for failing to register as a sex offender.

CLICK HERE TO GET THE FOX NEWS APP

The firearm recovered at the scene was a Lorcin Model L380 .380 caliber pistol, which had multiple rounds in the magazine and none in the chamber, police said.

Coleman was arrested on suspicion of attempted homicide of a peace officer, felony resisting arrest, possession of a firearm by a felon and a convicted person having a concealed firearm, FOX40 reported. The officer involved in the altercation suffered minor injuries, according to police.