Maple syrup gumming up the gun belt isn’t normally a hazard of police work. But it is a common problem for Cpl. Pamela Revels when students have been eating pancakes at the school breakfast.

“Kids like to come up and give you a little bit of a hug,” Corporal Revels said. “They don’t wipe their hands that well.”

Ms. Revels freely dispenses hugs and smiles at the schools where she works around Auburn, Ala. But she is also a sheriff’s deputy who wears a sidearm and a bulletproof vest, drives an official S.U.V. and has an AR-15 semiautomatic rifle stored nearby.

On Thursday afternoon, when a report came in about a man in camouflage carrying a gun near school, she sprang into action. As worried students and teachers locked themselves in classrooms and closets, she bolted outdoors, hurriedly walked around the sprawling campus and scanned the nearby woods until she was satisfied that it was safe for everyone to emerge.

“I can turn into a mama bear really quick,” she said. “And I’ve made that decision that nobody is going to hurt my babies if I can help it.”