After a shooting at a Parkland, Florida, high school left 17 people dead, the mayor of nearby Weston wanted to prohibit people from carrying guns in public buildings and parks – a move that could lead to him being kicked out of office and on the hook for thousands of dollars in fines and attorneys’ fees.

Florida law prohibits local municipalities from passing ordinances that regulate firearms or ammunition, and if one is passed that violates the state statute, it will be declared void. Elected or appointed officials involved in the drafting or passage of such local rules face fines of up to $5,000, will be unable to use a city attorney and could be held responsible for footing up to $100,000 of the legal bills for anyone who challenges the local rule in court. The governor is also given the power to kick them out of office.

Florida is among 43 states that in some way restrict municipalities from enacting gun laws stricter than those in place at the state level. After a spate of mass shootings during the past few months, some localities are challenging the laws in court or narrowly crafting rules that circumvent the state.

Weston Mayor Daniel Stermer joined nine other municipalities in a lawsuit earlier this month that says the penalties under Florida’s law are “onerous, unconstitutional and unprecedented” as well as “vindictive and expressly intended to be punitive in nature.”

Plaintiffs say the state laws have a chilling effect and force local officials out of taking action when it comes to guns in their communities – creating fears that local authorities could be held personally responsible for the changes.

“I’m putting my office where my mouth is,” said Stermer, who initiated the lawsuit and drafted the local gun control ordinance. A city commission will discuss it at an upcoming workshop. “I’m prepared to put my office on the line for this. Until we all stand up and say something, nothing’s going to change. Parkland is in our backyard.”

Florida’s law is part of a class of ordinances called preemption laws, which are aimed at curtailing local power. They are tangible examples of the growing divide between Republican statehouses and Democratic cities, and they have been enacted to address a spate of issues during the past three decades, including taxes and minimum wage.

The best-known example is the 2016 “bathroom bill” passed in North Carolina, which attempted to undercut Charlotte’s efforts to expand civil rights laws and tried to prevent cities from enacting their own minimum wage. The National Rifle Association was the driving force on the gun laws, most of which were put in place in the 1980s and 1990s. Florida’s preemption law was passed in the 1980s, and the fines were added in 2011.

“Generally, these laws were imposed by the NRA and its forces to restrict the ability of cities to enact more restrictive gun-control laws,” said Adam Winkler, a professor at the UCLA School of Law.

The NRA took a page from the playbook of tobacco companies – which realized that it is nearly impossible to control policy on the local level – turning their focus to statehouses, said Michael Siegel, a professor at the Boston University School of Public Health.

“By implementing preemption, they could concentrate all of their focus at the state level and not worry about going from town to town and fighting these laws,” he said.