A bulletproof vest is being credited with saving a New York police officer’s life after he accidentally shot himself while trying to outrun a rabid fox, officials said.

On Tuesday, 24-year-old

Officer Harold Nunuvero, 24, was responding to a call about the fox in Ellenville on Tuesday when the animal suddenly charged him. Nunuvero began running away and attempted to jump a fence -- but his foot got caught, causing him to flip over and fall to the ground, the Associated Press reported.

As he landed, Nunuvero’s gun went off -- and hit his bulletproof vest.

“That bulletproof vest, without doubt, without question, saved his life today,” Hudson Valley Village Police Chief Philip Mattracion told the Times Herald-Record.

Another officer, Sgt. Robert Morse, shot and killed the fox as Nunuvero lay on the ground.

Initially, Nunuvero didn’t even realize the shot from his gun had hit him, Mattracion said. The 24-year-old was treated at Ellenville Regional Hospital and later released.

CLICK HERE TO GET THE FOX NEWS APP

“He has an excellent work record and he’s been an excellent officer to have,” Mattracion told the newspaper.

Fox News’ Michael Sinkewicz and The Associated Press contributed to this report.