A North Carolina sheriff's deputy is recovering from a gunshot in the hip after an accident during a training exercise.

Gaston County Sheriff Alan Cloninger said the deputy underwent surgery Friday and was in stable condition. Cloninger says the bullet didn't strike any vital organs. The deputy has not been named.

The shooting happened at a Gastonia police firearms training center.

Investigators say the wounded deputy was cleaning his own weapon when another student's gun accidentally went off. That student was having some kind of a problem with his gun and was getting help from an instructor when it went off and hit the by-standing deputy.