A judge on Friday dismissed a wrongful-death lawsuit by Newtown families against the maker of the rifle used in the Sandy Hook Elementary School shooting massacre, citing an embattled federal law that shields gun manufacturers from most lawsuits over criminal use of their products.

State Superior Court Judge Barbara Bellis granted a motion by Remington Arms to strike the lawsuit by the families of nine children and adults killed and a teacher who survived the Dec. 14, 2012, school attack, in which a gunman killed 20 first-graders and six educators with a Bushmaster AR-15-style rifle made by Remington.

The families were seeking to hold Remington accountable for selling what their lawyers called a semi-automatic rifle that is too dangerous for the public because it was designed as a military killing machine. Their lawyer vowed an immediate appeal of Friday's ruling.

The judge agreed with attorneys for Madison, North Carolina-based Remington that the lawsuit should be dismissed under the federal Protection of Lawful Commerce in Arms Act, which was passed by Congress in 2005 and shields gun makers from liability when their firearms are used in crimes.

Advocates for gun control and against gun violence have criticized the law as special protection for gun makers. It became an issue in the presidential campaign this year when Hillary Clinton, now the Democratic nominee, criticized then-challenger Bernie Sanders for his support of the law in 2005. Sanders, a Vermont U.S. senator, is now backing a bill to repeal the law.

Lawyers for Remington said Congress passed the act after determining such lawsuits were an abuse of the legal system.

But the families' attorneys argued the lawsuit was allowed under an exception in the federal law that allows litigation against companies that know, or should know, that their weapons are likely to be used in a way that risks injury to others, and the judge disagreed.

"While the families are obviously disappointed with the judge's decision, this is not the end of the fight," said Joshua Koskoff, a lawyer for the families. "We will appeal this decision immediately and continue our work to help prevent the next Sandy Hook from happening."

Jonathan Whitcomb, an attorney for Remington Arms, declined to comment.

The company recently had been fighting to keep internal documents requested by the families from public view. The judge issued an order in August allowing certain documents containing trade secrets and other information to be kept from public view, but she said the order did not apply to all other documents in the case.

Besides Remington, other defendants in the lawsuit include firearms distributor Camfour and Riverview Gun Sales, the now-closed East Windsor store where the Newtown gunman's mother legally bought the Bushmaster XM15-E2S rifle used in the shooting.

Gunman Adam Lanza, who was 20 years old, shot his mother to death at their Newtown home before driving to the school, where he killed 26 other people. He killed himself as police arrived.