BYRON, N.Y. (WIVB) — A Genesee County Sheriff’s Deputy was rattled after a gunshot was fired into his police cruiser during a traffic stop in Byron on Monday.

Deputy Andrew Hale was at the Byron Arrow Mart writing a ticket for someone who wasn’t wearing a seatbelt when he heard a pop and his back windows shattered. According to the Sheriff’s Office, gunfire from a .22 caliber rifle pierced the cruiser.

“You really don’t know what’s going on,” said Hale. “You’re just trying to figure out first if it was a shot and secondly where did it come from? Where do I hide and where do I go?”

Deputy Joseph Corona was observing the traffic stop and immediately jumped into action.

“I put my patrol car in front of him and his vehicle,” said Corona.

Corona acted as a cover for Hale while they tried to figure out who fired the shot.

“Out of training, we hid behind our patrol cars,” said Hale.

Hale originally suspected the vehicle he pulled over. He soon realized it wasn’t, as the driver exited the car with his hands in the air and asked if Hale was okay.

It happened around noon and Corona said the gas station was busy.

“Just for our safety we explained to people, verbally, to please take cover, please get out of the area,” said Corona.

“There’s houses all over, it’s a residential area,” said Hale. “There was really no telling initially where that shot came from.”

Corona said he saw a man at an open second story window at the Byron Hotel across the street.

When backup arrived, four members of the Genesee County Sheriff’s Office, including Hale, went up to the room. They said they found a slightly intoxicated David Michael O’Connor with a rifle and box of ammunition.

“There was no struggle, he offered no resistance,” said Sheriff Gary Maha. “The officers which took him into custody, he just went along with them, like I said he made admissions and they placed him under arrest.”

Sheriff Maha said O’Connor may have been living at the hotel since last year. He said there was no evidence in the room showing O’Connor had bad feelings towards law enforcement.

“You’ve got to be mentally ill to be so blatant about it, to do it at all really,” said Dennis Mulcahy, who lives across the street from the hotel.

Mulcahy and his wife, Deborah, said they’ve seen O’Connor at his window before.

“That is really scary, especially since we live next door,” said Deborah Mulcahy. “What if something ricocheted over to our house?”

For Deputy Hale and Deputy Corona, the shooting is a reminder to remain on alert.

“The traffic stop has become 360, it’s not just right in front of you,” said Hale. “You have to be more aware of the hostility towards police officers.”

O’Connor has now been charged with attempted aggravated murder of a police officer, felony first-degree reckless endangerment and felony third-degree criminal mischief.

O’Connor is being held in the Genesee County Jail without bail. He is due back in court on March 14.