A northern California sheriff’s deputy was "lucky" to survive a gunshot to the chest after his body camera helped to block the bullet an unknown suspect fired during an "ambush" attack near a reservoir Friday night, investigators said.

Santa Clara County Sheriff’s Deputy Sukhdeep Gill was on a routine patrol along a rural mountain road in the foothills of unincorporated Morgan Hill, Calif., near the Uvas Reservoir, when he got out of his patrol vehicle, the sheriff’s office said in a news release.

ILLINOIS TROOPER FATALLY SHOT IN CIGAR BAR BY WOMAN WHO SCRAWLED THREAT ON CONDO WALL

An unknown vehicle approached Gill and suddenly switched off its headlights. At least four gunshots were fired, with one bullet striking the deputy in the chest, FOX KTVU reported. The deputy returned fire, but it was not known whether the suspect was hit.

The sheriff’s office released Gill’s frantic call to dispatchers in which he can be heard shouting “shots fired,” the San Jose Mercury News reported. After two minutes of radio silence, Gill told dispatchers, “I think I was hit.”

The deputy was treated at a hospital and subsequently released without any serious injuries, officials said.

A body camera worn by Gill was partially to thank for protecting him from a bullet that struck him in the chest, officials said. (Santa Clara County Sheriff’s Office)

Investigators described the shooting during a news conference Monday as an “unprovoked attack” that  Gill “was very lucky” to survive, according to local news outlets.

“It was an ambush,” Santa Clara County Sheriff Laurie Smith said. “Anyone of those rounds could have hit him anywhere. He was very brave under fire.”

VIRGINIA COP DIES AFTER BEING DRAGGED BY VEHICLE TRYING TO FLEE TRAFFIC STOP, POLICE SAY

Gill survived thanks in part to the bullet hitting his body camera, which was backed up by his standard-issue protective body armor, according to Lt. Brenden Omori, head of the department’s Major Crimes Unit.

“We do know the bullet was stopped by a combination of the bodycam and the body armor,” he said.

The shooting is being looked at as both a potential hate crime and a premeditated attack on a law enforcement officer. Gill, who is a practicing Sikh, wears a turban that is clearly visible, officials said.

CLICK HERE FOR THE FOX NEWS APP

Investigators are searching for the suspect. The suspect's vehicle is believed to be a silver-colored Honda sedan from the 2000s.