JEFFERSON CITY, Mo. (AP) — A Missouri measure attempting to nullify some federal gun control laws fell a single vote short of enactment Wednesday as the leaders of the state’s Republican-led Senate joined with Democrats to prevent a veto override.

Senators voted 22-12 for the veto override, coming up just shy of the required two-thirds majority. Senate President Pro Tem Tom Dempsey and Majority Leader Ron Richard split from the rest of the GOP caucus that they lead to instead sustain Democratic Gov. Jay Nixon’s veto.

The override attempt had passed the Republican-led House 109-49, getting the bare minimum number of votes needed.

The legislation declared that any federal policies that “infringe on the people’s right to keep and bear arms” shall be invalid in Missouri. It would have allowed state misdemeanor charges to be brought against federal authorities who attempted to enforce those laws or anyone who published the identity of a gun owner.

“My love of the Second Amendment doesn’t trump my love of the First Amendment,” Dempsey, of St. Charles, told reporters after the vote. “We need to work harder on crafting the legislation.”

Dempsey and Richard, of Joplin, both also cited concerns about how the legislation could have affected local police and prosecutors.

Nixon vetoed the gun bill in July while warning that it infringed on First Amendment free-speech rights and also violated the supremacy clause of the U.S. Constitution, which gives precedence to federal laws over conflicting state ones. He stuck by those assertions Wednesday.

“It’s unconstitutional, it’s unsafe and it’s unnecessary,” Nixon said at a news conference before the Senate vote.

Attorney General Chris Koster, a Democrat, also raised concerns last week about the ramifications of a potential veto override. He said a court likely would strike down the nullification provision but could leave intact other sections of the bill that could potentially prevent local police from cooperating with federal authorities on crimes involving guns. He said the bill also could open Missouri police to potential lawsuits from criminals if they refer gun-related cases to federal authorities.

Sen. Brian Nieves, a Republican from Washington, Mo., accused Koster of lying about the bill in a last-moment smear campaign that he said “literally scares the bejesus out of our great law enforcement community.”

“This fight ain’t over, it ain’t over, it ain’t over,” Nieves said. “We’ll be back to visit it again” in the 2014 session.

Dempsey said he would help “fast-track” a gun-rights bill next year that attempts to address his concerns.

The gun bill was one of the highest profile measures among Nixon’s 33 vetoes this year. Legislators overrode 10 of those vetoes, the greatest single-year total in Missouri since 1833 when a different constitution only required a simple majority.

Lawmakers failed, however, to override Nixon’s veto of a sweeping income tax cut, giving him a victory on one of the most hard-fought measures.

The Missouri gun legislation was one of the boldest examples yet of what has become a nationwide movement among states to nullify federal laws with which local officials disagree. A recent analysis by The Associated Press found that about four-fifths of the states now have enacted laws that directly reject or conflict with federal laws on marijuana use, gun control, health insurance requirements and identification standards for driver’s licenses.

The Brady Center to Prevent Gun Violence said Wednesday that it was prepared to immediately file a federal lawsuit against the Missouri measure if the veto override had succeeded.

“This outrageous law would allow criminals to buy machine guns and make federal law enforcement officers into criminals for trying to stop gun crimes,” Jonathan Lowy, director of the Brady Center’s legal action project, said in a written statement.

The Missouri Press Association also had threatened a lawsuit challenging the constitutionality of the provisions barring the publication of the name, address or other identifying information of any person who owns a firearm.

A couple hundred gun-rights advocates had rallied Wednesday on the Missouri Capitol lawn in a last-moment lobbying push for the bill.

“We need to take control from the federal government and their overreach of taking away our rights,” said Gene Dultz, 60, of St. Louis, who was wearing a National Rifle Association hat and shirt while standing in the crowd.

The NRA maintained a conspicuous public silence about the bill, declining to answer repeated questions from the media about whether it supports or opposes the measure.

The House sponsor of the bill, Rep. Doug Funderburk, of suburban St. Louis, had described the measure as an attempt to “push back the tyranny of an out of control and incompetent federal government.”

One of the specific federal laws that the Missouri nullification bill cited was the Gun Control Act of 1934, which imposed a tax on transferring machine guns or silencers. The bill also would have invalidated any federal law requiring fees, tracking or registration of firearms or ammunition that “could have a chilling effect on the purchase or ownership of those items by law-abiding citizens.”

Other parts of the bill would have lowered Missouri’s concealed-gun permit age to 19 instead of 21 and allow specially trained teachers or administrators to serve as a “school protection officer” able to carry a concealed gun.