HARRISBURG, Pa. — Pennsylvania’s capital is facing a lawsuit believed to be the first filed under a new state law designed to give gun owners and gun rights groups a better chance at dismantling illegal municipal firearms ordinances.

The lawsuit filed Tuesday in Dauphin County court named as defendants the city of Harrisburg and various city officials.

Houston-based U.S. Law Shield and two members of its Pennsylvania chapter filed the lawsuit, asking the court to stop Harrisburg from enforcing various firearms ordinances. They include ordinances that ban possession of firearms in parks, allow the mayor to prohibit public possession of weapons in a declared state of emergency and require gun owners to report lost or stolen firearms to police.

The 48-page complaint said the defendants possess and use their guns in accordance with state law, but they are now “in danger of facing prosecution and criminal penalties.”

The law took effect last week. After Gov. Tom Corbett signed it last year, the National Rifle Association lauded it as “the strongest firearms pre-emption statute in the country.”

A city spokeswoman had no immediate comment on the lawsuit. Mayor Eric Papenfuse has previously said the state law represents “a fringe ideological view” and that rescinding those ordinances sends the wrong message, given the problem of gun violence in cities like Harrisburg.

Meanwhile, the cities of Philadelphia, Pittsburgh and Lancaster are challenging the law in court, saying lawmakers approved it in violation of state constitutional provisions designed to promote transparency in the legislative process.

Pennsylvania, which has a strong tradition of hunting and gun ownership, has long prohibited its municipalities from enforcing firearms ordinances that regulate the ownership, possession, transfer or transportation of guns or ammunition.

But Pennsylvania cities trying to curb gun violence have chafed against that directive, and gun rights groups had complained that scores of municipal gun measures were difficult to challenge successfully in court because judges have ruled that plaintiffs could not prove they were harmed by it.

Under the new state law, gun owners no longer have to prove they have been harmed by the local measure to challenge it, and “membership organizations” like the National Rifle Association can stand in to sue on behalf of any Pennsylvania member.

Some municipalities have moved to repeal their firearms ordinances instead of defending them in court..