(Reuters) - A judge upheld Seattle’s new tax on firearms and ammunition sales on Tuesday, rejecting a challenge from the National Rifle Association claiming the measure violated a state law barring municipalities from enacting firearm legislation.

Bullets handed in to the Seattle Police Department during the gun buyback event in Seattle, Washington January 26, 2013. REUTERS/Nick Adams

The Seattle City Council unanimously approved a “gun violence tax” on sellers of firearms and ammunition in August, directing proceeds toward violence prevention programs and research beginning in January 2016.

A companion measure requires gun owners to report cases of lost and stolen firearms to police.

On Tuesday, King County Superior Court Judge Palmer Robinson denied a request by gun rights groups for an injunction, saying the tax did not violate state law and was a “lawful exercise of Seattle’s taxing authority.”

The National Rifle Associations (NRA) and other pro-gun groups vowed to appeal against the ruling, maintaining that the tax does not comply with a Washington state law that bars municipalities from creating their own gun regulations.

They also said the tax would hurt small gun dealers, with customers driving to other retailers outside the city limits to avoid the tax.

“We are going to fight this vigorously in defense of a state preemption law that has served Washington citizens well for more than three decades,” said Alan Gottlieb, founder of the pro-gun rights group Second Amendment Foundation.

The only other municipality in the country with an individual tax on gun sales is Chicago, according to the NRA.

Under the new Seattle law, gun sellers will be taxed $25 for every gun sold plus 2 or 5 cent taxes on each round of ammunition.

Seattle City Council President Tim Burgess said the tax was a “legitimate and appropriate way to raise revenue for gun safety research and prevention programs” in the city.

“Judge Robinson saw through the NRA’s distorted efforts to put gun industry profits ahead of public safety,” Burgess said in a statement.

Earlier this month, the Republican-run House of Representatives blocked a Democratic effort to consider bipartisan gun control legislation in the wake of repeated, highly publicized mass shootings in the United States.

There was an average of 131 deaths attributed to firearms each year in King County, which includes Seattle, between 2006 and 2010, KIRO-TV reported.