A Contra Costa County sheriff's deputy was shot in the leg when his gun accidentally discharged, sheriff's spokesman Jimmy Lee said.
The incident happened at about 9:15 a.m. Wednesday in the 800 block of Magnolia Avenue in unincorporated Martinez.
Two deputies in the department's civil unit had gone to the area to evict someone from a home, Lee said.
As one of the deputies was getting out of the car, his gun accidentally went off, causing a superficial injury to his right leg.
He was taken to John Muir Medical Center in Walnut Creek, where he was treated and released less than an hour later, Lee said.
The deputy is 39 years old and has been with the sheriff's office for 10 years, Lee said.
The accident is still under investigation, but right now "we have no idea how this happened," Lee said.