HARRISBURG, Pa. (AP) — A state appellate court on Thursday struck down a law designed to make it easier for organizations like the National Rifle Association to challenge local firearms ordinances in court.

The Commonwealth Court said the procedure that the Republican-controlled Legislature used to enact the law in the final days of last year’s session violated the state constitution.

Under the law, gun owners no longer had to show they were harmed by an ordinance to challenge it, and it let “membership organizations” like the NRA sue on behalf of any Pennsylvania member. It also allowed them to recover damages if they are successful.

Five Democratic legislators and the cities of Philadelphia, Pittsburgh and Lancaster sued to block the law. The GOP respondents included House Speaker Mike Turzai and then-Gov. Tom Corbett, who was ousted in his re-election bid last year.

The ruling sends “a very strong message to the General Assembly that the old way of doing business just isn’t acceptable anymore,” said Mark McDonald, press secretary to Philadelphia Mayor Michael Nutter. “The law requires and the public expects transparency, deliberation and public debate.”

Said Pittsburgh Mayor Bill Peduto: “I’m overjoyed that the court system is joining us in standing up for citizens and public safety instead of special rights for the gun lobby.”

The gun provision was merged with a bill whose intent was to establish criminal penalties for theft of secondary metals, such as wires or cables. The judges said that process violated constitutional requirements that bills may not be altered to change their original purpose and must be confined to one subject.

(© Copyright 2015 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)