A Florida school resource officer was fired Wednesday after accidentally discharging his gun in a school cafeteria this year.

Jonathan Cross, a resource officer at Thomas E. Weightman Middle School in Wesley Chapel, Florida, was "terminated for conduct unbecoming (of an officer) and mishandling of a weapon," Pasco County Sheriff Chris Nocco said at a news conference Wednesday.

The incident took place at around 12:40 p.m. on April 30, when Cross' holstered, duty-provided pistol discharged into a wall while students were in the cafeteria going through the lunch line, Pasco County School public information officer Linda Cobbe told USA TODAY.

No students or school employees were injured.

Though initial reports said the pistol discharged "unexpectedly" because Cross was leaning against a wall, Nocco clarified that Cross "has a bad habit of fidgeting with his gun" and was when it accidentally fired.

"Thank God that no kids were hurt," Nocco said. "It's sad what we have to do today, and it would have been tragic if a child was harmed."

After the incident, Cross went on paid administrative leave while the investigation was pending. Investigations from the Sheriff's Office and the Florida Department of Law Enforcement determined there was "nothing wrong with the handgun."

The investigation revealed, Nocco said, that a student had witnessed the resource officer fidgeting with the gun in and out of its holster.

"Our members are trained on our weapons for proper handling, and his actions were nothing that we trained," Nocco said. "These things should only be pulled out or utilized in training ... or for deadly force because your life or someone else's life is on the line."

Cobbe cautioned that "no amount of training will stop someone from being careless," but the school district is "confident that their deputies are highly trained."

No criminal charges were filed against Cross.

Follow Joshua Bote on Twitter: @joshua_bote