A sheriff in Ohio was struck by a rogue bullet while sitting inside a law enforcement cruiser on New Year's Eve. He luckily lived to tell about it.

The bullet that ended up hitting Sheriff Matthew Treglia first ricocheted off a local police department's patrol car, according to a Facebook post from the Allen County Sheriff's Office. The bullet then passed "inches" from a major's face, went through the open window of Treglia's cruiser and hit him in the chest.

The whole incident took place about five minutes after the area had started to celebrate the new year, according to the sheriff's office. Allen County is about 80 miles north of Dayton, Ohio.

A spokesman with the sheriff's office told USA TODAY that Treglia was wearing a bulletproof vest at the time, "but also the round would have lost a significant amount of speed after striking the cruiser first."

New Year's Eve gun violence:Concludes record-high year of mass killings

"We're unable to know for sure what injuries would have been sustained had (the bullet's) first contact been with a person rather than the vehicle," the spokesperson said.

The sheriff's office posted a video of the incident, taken by Maj. Todd Mohler. The video was taken to show the "extraordinary number of 'celebratory' gunshots being fired within the city limits," according to the department's Facebook post.

Near the end of the video, after several loud pops are heard, a crash startles Mohler.

"That was a (expletive) round," one of the officers in the video says.

"You're (expletive) me, dude," the other replies.

"What goes up, must come back down," the sheriff's office wrote on Facebook. "Shooting any type of gun into the air is extremely dangerous and illegal. Please, handle any and all firearms safely and responsibly."

The sheriff's office spokesperson said the department made no arrests related to weapons being fired on New Year's Eve.

Law enforcement agencies across the nation warned against firing guns into the air on New Year's Eve as a way of celebrating the arrival of 2020.

Others weren't as fortunate as Treglia.

A 61-year-old woman in Houston was killed after being struck by a random bullet outside her home at 12:01 a.m. Wednesday. A 3-year-old in Phoenix was struck by random gunfire and sustained injuries that weren't life-threatening, the Arizona Republic reported.