A spokesperson for the Sheriff's Office says one round hit the ground, and nobody was injured - but acknowledged the gun was, quote, "negligently discharged."
Supervisors are now addressing the incident with the deputy involved.
It happened as dozens of deputies worked to evacuate hundreds of people, including inmates, out of the courthouse during a fire alarm.
Action News cameras were rolling as a judge halted a murder trial for the alarm.
Officials say Michelle Sneed of Madera is responsible for falsely pulling the alarm.
Court documents reveal the 45-year-old was in court for a probation review hearing.
The Sheriff's Office says she was arrested and booked into county jail for the incident Tuesday morning.