HARRISBURG, Pa. — Pennsylvania lawmakers moved closer Tuesday to re-enacting legislation that would let the National Rifle Association and similar groups challenge local gun regulations that are more restrictive than state law.

The House Judiciary Committee voted 21-6 for a bill that is nearly identical to a version thrown out by Commonwealth Court last year, a decision upheld by the state Supreme Court in June.

The proposal gives standing to state residents who are gun owners — as well as organizations they are members of — to file challenges to local gun ordinances, and if successful to be reimbursed for reasonable expenses.

The previous law was invalidated because it was deemed to violate a ban in the state constitution on bundling unrelated topics in a single bill. It had been enacted as part of legislation that also addressed the theft of metal.

“The law itself is not unconstitutional — it’s the way it was put through,” Rep. Mark Keller, R-Perry, said during committee debate. Keller is the bill’s prime sponsor.

The new version adds a provision requiring 30 days’ notice before filing a lawsuit, to give municipalities time to repeal their ordinances and avoid litigation.

The prior version was rushed through the Republican-controlled Legislature and signed in 2014 by then-Gov. Tom Corbett, also a Republican. The NRA then sued over local gun regulations in Pittsburgh, Philadelphia and Lancaster, and other municipalities responded by repealing their local ordinances.

Supporters of the revised measure said statewide uniformity makes more sense than a patchwork of local ordinances that can be difficult to track and comply with.

“There are municipalities that refuse to abide by the law of pre-emption, that’s the bottom line,” said Rep. Bryan Barbin of Cambria County, one of several Democrats to vote with all but one Republican on the committee to advance the bill.

Rep. Madeleine Dean, D-Montgomery, said 30 days probably won’t be enough time for local municipalities to act.

She said she was concerned about giving standing to people from across the state to sue in her backyard and asked whether the Ku Klux Klan or ISIS could sue, calling it a “frightening possibility.”

An ISIS member who sued would likely be met by FBI agents at the courthouse, said Rep. Mike Regan, R-York.

“I think it’s ridiculous to even take it that far — it’s a stretch,” Regan said.

State law generally prevents townships, boroughs and cities from enacting gun laws that go beyond state restrictions, but gun rights advocates say that when that occurs, individual residents can lack the motivation or resources to go to court and seek to overturn them.

Keller said he hoped to get a floor vote on the bill during the legislative session, which could be over by the end of October.

He said the committee vote suggests the full House might pass it with a veto-proof majority, taking any decision away from Democratic Gov. Tom Wolf. The governor’s office said Tuesday he opposes the bill in its current form.

A similar bill is also under consideration in the state Senate.