A firearms instructor in southern Massachusetts has been assigned to other duties after his gun accidentally went off while he was teaching a class on weapons safety.

Officials say the Glock handgun discharged while Maj. Donald Lamar was demonstrating to Bristol County deputy sheriffs how to safely holster the weapon.

The bullet ripped a hole in Lamar's pants but missed his leg and foot.

Sheriff Thomas Hodgson says the officer made a "gross error in judgment" by not emptying the weapon before the class last week.

Lamar, a certified firearms instructor since 2005, was transferred to another division and will not carry a firearm while the incident is being investigated.