Stephen Benjamin's transformation from an ordinary gun-owning Southern mayor to one who advocates limits on firearms began in the summer of 2015. That's when the Ku Klux Klan and the New Black Panther Party came to his hometown, Columbia, South Carolina, to face off over the removal of a Confederate flag from the state Capitol.

Fearing a gunbattle, Benjamin and the City Council enacted an emergency ordinance banning firearms from an area surrounding the Statehouse.

The gambit worked.

No one was shot.

And an idea was born.

Today, Benjamin is helping to lead a movement among municipal governments to control the possession and use of firearms within their borders. Frustrated by state and federal lawmakers' reluctance to address gun violence, local officials are taking on their lawmakers and governors, an uphill task given that all but seven states have laws prohibiting them from enacting measures that restrict the use of guns.

Columbia, S.C., Mayor Stephen Benjamin speaks during the 2016 Democratic National Convention in Philadelphia. J. Scott Applewhite / AP file

But their work is slowly catching on. In recent months, local governments have limited certain kinds of semi-automatic rifles, created "gun-free zones" and adopted zoning laws to keep out gun stores. Even though some of these measures have faced legal challenges, the movement's leaders say they're just getting started.

"The failure of the Congress to pass policies that keep our communities and children safe means towns feel compelled to act," Benjamin said. He considers himself in a unique position to press the issue, because he strongly supports Second Amendment rights, is a former law enforcement official and is president of the U.S. Conference of Mayors. "We don't have to accept the carnage," he said.

The origin of state 'pre-emption' laws on guns

While states are able to pass laws that differ from the federal government's, municipalities don't have much power to act independently, said political scientist Robert Spitzer, a gun policy expert at the State University of New York at Cortland. If they did, it could lead to a patchwork of laws that change every few miles, he said.

To keep towns in line, many states have passed laws to curtail local control on specific issues. These "pre-emption" laws, often pushed by industry groups, have prevented municipalities from challenging state decisions on a range of issues, from fracking bans to "sanctuary city" policies to the expansions of LGBTQ rights.

State attempts to curb gun laws date to the 1990s, when the National Rifle Association modeled a nationwide campaign for pre-emption laws on a successful effort by the tobacco industry to rein in local smoking rules a decade earlier, according to a study by Lori Riverstone-Newell, a political science professor at Illinois State University.

Forty-three states now have laws preventing municipal governments from passing gun regulations that go further than state ones. Six of the remaining seven ─ California, Connecticut, Hawaii, Massachusetts, New York and New Jersey — already have restrictive gun laws, said J. Adam Skaggs, chief counsel of the Giffords Law Center to Prevent Gun Violence.

Until recently, it's been rare for a town to defy its state government on guns. Localities typically "aren't interested in wading into the thicket, and pre-emption laws are a reason," Spitzer said.

How Columbia took a stand

But to Benjamin, the issue of gun violence was urgent enough to go up against the state.

His decision followed the June 2015 massacre of nine black church parishioners by a white supremacist 120 miles away in Charleston, which spurred calls to remove emblems of South Carolina's racist history, in turn prompting the opposing marches in Columbia. The city's leaders knew that South Carolina's strict firearms pre-emption statute prohibited them from acting on their own to stop the demonstrators from carrying guns. But they did it anyway, because the marches would be over by the time a judge could strike the ordinance down.

“It’s painfully clear that if anything meaningful is going to happen, it's going to have to happen at the local level.”

Benjamin believes that the ordinance — which was indeed invalidated, but not until after the marches — saved lives. And it got him thinking about other ways to get around state law, which curtails local governments' ability to regulate firearms and ammunition.

The next opportunity came after a gunman used semi-automatic rifles outfitted with bump stocks, which make guns deadlier by enabling them to function like automatic weapons, to kill 58 people in Las Vegas last October. While Congress and the Trump administration considered outlawing the bump stocks, Benjamin and the City Council ─ all but one of whose six members is a gun owner ─ proceeded alone, making Columbia the first city in the country to enact a bump stock ban. The ordinance, which exploited a loophole in state law that left open restrictions on such gun accessories, was aimed at inspiring other local governments "to start moving the needle toward common-sense gun laws," Benjamin said.

It seems to have worked. Several other municipalities, including Cincinnati, have implemented similar bump stock bans, and momentum on a variety of other gun restrictions has picked up since since the Feb. 14 killings of 17 people at a high school in Parkland, Florida. Boulder, Colorado, for example, banned "assault weapons" in May.

"It's time for municipalities to take the lead on this, and while just the city of Boulder alone, with our 100,000 people, may not move the needle, if other municipalities follow suit and this becomes a national trend, that'd be really important," Boulder City Council member Jill Adler Grano said at an April meeting, according to The Daily Camera newspaper.

Local gun limits face pushback

Gun rights groups have fought back, suing to block the ordinances. Their challenges have led judges to issue temporary injunctions against gun restrictions in Columbus, as well as in Deerfield, Illinois, which banned semi-automatic weapons like the AR-15. Similar fights are simmering in Cincinnati and Boulder.

A protester carries his AR-15 at a pro-gun rally in Boulder, Colorado, on April 21. Rick T. Wilking / Getty Images

State pre-emption laws offer a necessary "layer of protection" for law-abiding gun owners, said William Perry Pendley, president of the Mountain States Legal Foundation, which sued Boulder on behalf of local gun owners and gun-related businesses.

Boulder's actions are proof that Colorado's 2003 pre-emption law on guns "was a good idea," Pendley said.

"I can assume that it was done by the General Assembly in fear that some unit of local government would try to restrict someone's Second Amendment rights, and now, big surprise, Boulder did it," Pendley said. "Our worst fears were realized."

In addition to passing defiant gun restrictions, some towns are also beginning to target the state pre-emption laws directly. In Florida, 10 cities sued the state, saying its penalties for passing local gun laws ─ including removal of elected leaders from office ─ were unconstitutional.

That lawsuit, city officials say, could create an opening to pass local regulations.

"Attacking the penalty provision was a first step these municipalities have taken, and there will be more challenges to the pre-emption statute itself," said Aleksandr Boksner, chief deputy city attorney for Miami Beach. "This is nothing more than a first step."

Benjamin, the mayor of Columbia, also wants to see cities implement "gun-free school zones," which are permitted under federal law.

"It's painfully clear that if anything meaningful is going to happen," Benjamin said, "it's going to have to happen at the local level."