San Diego police officers shot a man they say slipped out of handcuffs and grabbed a gun from the back of a police SUV.

The incident happened Sunday at San Diego Police Department headquarters.

Police said officers shot the man after he ignored demands to drop the weapon and fired one round at them, according to reports.

SAN DIEGO COP RESCUES TWIN GIRLS, 2, AFTER DAD DRIVES OFF CLIFF, INVESTIGATORS SAY

The 25-year-old Hispanic man was taken to a hospital for treatment and was expected to survive, Fox 5 San Diego reported. He was shot in the chest.

San Diego Police Department headquarters. (SDPD)

The man had been arrested at a downtown hotel earlier in the evening after police said he was acting strangely and threatening a security guard, The San Diego Union-Tribune reported. Police said the security guard fought off the man with pepper spray.

At headquarters, the man was left in the back seat of a police SUV as the arresting officer went inside to fill out booking paperwork, according to the paper.

Capt. Rich Freedman said it was at that point the man slipped out of his handcuffs and broke a plexiglass divider in the vehicle between the back seat and trunk area, the paper reported. There he found the officer’s backup handgun in a backpack.

WISCONSIN POLICE OFFICER FATALLY SHOOTS BLACK MAN ALLEGEDLY WIELDING KNIVES, FAMILY SAYS RACE PLAYED ROLE

“The male was able to grab the handgun and bring it into the rear of the police car,” Freedman said, according to the paper.

Police said officers saw he was armed when they went to check on him.

Lt. Andra Brown said that after being shot, the man “reached out the car window, opened the door, and exited the patrol vehicle. He was still armed with the handgun and would not comply with officers’ directions,” according to the paper.

CLICK HERE TO GET THE FOX NEWS APP

He was finally subdued after he was bitten by a police dog who was brought in to assist, the paper reported. The man was then handcuffed and given medical treatment.