He drove away, but raced back as soon as he realized he was unarmed.

Last year, San Mateo County Sheriff’s Captain Jeff Kearnan ­— a homeland security expert with a recent master’s degree from the Naval Intelligence School in Monterey — left his duty weapon on the toilet paper dispenser in the bathroom of a Dublin car dealership.

Then there was what Wedick, the retired FBI agent, called an unfortunate fact about gun holsters: It’s difficult to use a toilet without taking one off.

“Surprise surprise,” he began an email to his bosses. The gun had been inside the bag all along.

Cops interrogated carwash workers and searched their homes as part of a full-scale investigation, documents show. Days later, the investigator was cleaning at home when he found a bag.

Sometimes guns were temporarily misplaced. An investigator for the state Alcoholic Beverage Control agency reported his weapon stolen to Fresno police after he put his state vehicle through a local carwash.

That could have helped in a variety of scenarios where guns vanished in a flash. A Gilroy cop and a Marin County deputy each left weapons on the tailgates of their trucks. They fell off. The Marin gun was found in a field and returned.

Some departments are exploring technology that would help track down lost and stolen guns, similar to GPS trackers that help people locate missing cellphones, Ahern said.

How some of the guns were lost

Here is a sampling of the 192 guns stolen from Bay Area police and state and federal agents across the state since 2010:

Officers sometimes failed even the simplest steps to safeguard their weapons: locking their cars. Thieves made off with guns from unlocked cars parked at two San Francisco police officers’ homes in Novato, an Alameda County Sheriff deputy’s residence in Manteca, a CHP officer’s home in Chula Vista and another patrolman’s home in Napa. He had left a gun inside an unlocked truck for three days.

Even cops who do everything right can have a gun stolen. In 2013, a CHP officer hung his duty weapon inside his locked locker at a station in Merced County and went home for the weekend. Come Monday, the gun was gone. Turned out that if someone pulled the locker handle hard just the right way, he could slip a hand inside. The CHP noted that a cleaning crew had been in the locker room on Saturday and Sunday.

A man was arrested in 2011 in Modesto carrying what turned out to be a gun stolen from the CHP. A cop asked the suspect: "Where’d you get it?" His answer: "Bought it in Stockton from a guy named 'Tichel.'" The cop asked if the man suspected the gun might have been stolen from law enforcement. "Nah," the man claimed. He didn’t really look at the gun. He must not have, considering it bore a very distinct seal on the grip that said: CALIFORNIA HIGHWAY PATROL.

Thieves entered the state Department of Fish and Game’s Redding office in 2013 through a roof vent and stole two assault rifles and two shotguns. The guns were in a locked cabinet but not a safe. The building’s burglar alarm was broken.

Sometimes it’s hard to know. Responses to requests for documents about stolen police guns varied greatly across more than 200 public agencies this news organization surveyed. The Alameda and San Francisco County sheriff’s offices released complete records showing how guns were stolen. But others, especially local departments taking reports on CHP guns, exercised heavy censorship. Roseville, the Shasta County Sheriff and Fairfield police released page after page of documents in which nearly all the words were blacked out.

A CHP officer left his .40-caliber Smith & Wesson duty weapon on the arm of a living room chair in his Los Angeles home in 2011. A thief sliced through a screen door and snatched the weapon.

A San Francisco Sheriff’s deputy stashed two Glock handguns under his bed in Sunnyvale in 2011 and left home to spend the night elsewhere. His girlfriend’s daughter invited friends over for a party, and the next day the guns were gone. One of the partygoers was affiliated with the Norteños street gang and was eventually arrested in connection with the missing guns. Sunnyvale police later found one of the weapons inside a garbage bag stashed in a city park.