A San Francisco sheriff’s deputy accidentally discharged a non-duty weapon, a "baby Glock," inside the Hall of Justice on Wednesday morning, apparently while trying to demonstrate the proper use of the weapon to a colleague.

The round narrowly missed the fellow deputy, but no one was injured.

San Francisco Sheriff’s Department spokeswoman Eileen Hirst said the discharge occurred before court started and was under investigation. She was not able to provide details, pending the outcome of the probe.

“An accidental discharge of a firearm is a very serious matter,” she said. “We are all very grateful that no one was injured.”

Sources say that Rhonda Gaines, a 20-plus year veteran, brought the gun to work and that Sotero Santos accidentally fired it. Hirst would not confirm either identities but said that the person who fired the weapon is receiving a one-on-one refresher on firearm training, as is the deputy who brought the weapon to the courthouse.

Hirst also told NBC Bay Area that the deputy who brought the weapon to work remains on duty and has not been disarmed. As a bailiff, that employee doesn't carry a weapon for her current post. In addition, Hirst said the sheriff is issuing a departmentwide firearm safety bulletin and updated training on firearms safety.

As for whether there will be any discipline, Hirst would only say "we are investigating the entire incident."

Superior Court spokeswoman Ann Donlan said the accidental gunfire was reported at 7:10 a.m. It occurred inside an office used by court bailiffs near the chambers of the criminal supervising judge, Teri Jackson, as well as the court administrator’s office. Officials said the court administrator was in his office at the time. "As far as I know, no other staff had been in the vicinity when it happened,” Donlan said.

The round pierced the wall, fell in a cavity, and can't be retrieved.

Sources told NBC Bay Area that Gaines brought the handgun, a 22-caliber “baby” Glock, to work and was apparently not familiar with how it operated. She handed it to Santos and asked him about its use, sources said. The second deputy pointed the weapon at the first deputy and – apparently unaware the weapon was loaded – pulled the trigger. The round missed the her, piercing an equipment storage cabinet, before lodging in the office wall.