Some gun owners here see even those exceptions as infringing on their freedom. Robert Kennedy, a founder of the gun-rights organization BamaCarry Inc., left his polling place in a church annex rather than surrender his firearm, the group’s president, Eddie Fulmer, said in an interview. The news website al.com quoted Mr. Kennedy as calling Mr. Strange’s opinion “horrible.” He added that the exemption allowing private buildings to bar the open carrying of guns “places somebody’s private property rights over somebody’s right to vote.”

But even among some less passionate gun owners, Mr. Allen’s complaint about the ban strikes a chord. If many people associate firearms with this nation’s epidemic of mass shootings and mindless violence, Chambers County is a place where, as Mr. Allen said, his boyhood friends carried pistols from a young age and drove to school with gun racks in their cars.

Under state law, anyone who legally owns a gun is entitled to strap on a holster and carry it in plain sight. Throughout the state, at least 21,000 Alabamians exercise this “open carry” option on a regular basis, said George Owens, a Mobile resident who is the legislative affairs and public policy director for the advocacy group Alabama Gun Rights. In Mobile County alone, more than 34,000 of the 413,000 residents counted in 2012 held a permit to carry a concealed weapon.

“It’s a matter of cultural identity,” Mr. Owens said. “If you went to a Walmart in Mobile and there were 100 people present, there are going to be eight of them who are gun-permit owners.” Nationwide, about 11.1 million people hold permits to carry concealed weapons, or roughly 3.5 of every 100.

In Chambers County, a down-at-the-heels stretch of farms and forest on the Georgia border, a tradition of gun ownership has only been strengthened by the social and economic winds now sweeping away old ways of life. The county’s textile plants — here and in adjacent West Point, Ga., which once spun out millions of towels and bed clothes — are gone, and with them a way of life that was the community’s anchor. Residents say that youth gangs are a growing problem and that crime is on the rise; in March, the county indicted 41 people on charges of trafficking in cocaine, methamphetamine and other illegal drugs, Mr. Allen said, adding that guns are no longer just a tradition, but a necessity.

Not everyone shares Mr. Allen’s alarm or embraces guns with such ardor. “We have a really good community here, a good group of people,” said Skip McCoy, the private lawyer and county attorney who asked the attorney general for an opinion on banning guns at polling places. “I think the majority of people here believe everyone should have constitutional rights as long as they don’t offend someone else.”

But enough people share Mr. Allen’s view that in last month’s Republican primary, they chose him to run for county sheriff. Mr. Allen, a 50-year-old computer technician, has been endorsed by BamaCarry, and has left his job to campaign full time.