HARTFORD, Conn. — Gun maker Remington can be sued over how it marketed the Bushmaster rifle used to kill 20 children and six educators at Sandy Hook Elementary School in 2012, a divided Connecticut Supreme Court ruled today.

Justices issued a 4-3 decision that reinstated a wrongful-death lawsuit and overturned a lower court ruling that the lawsuit was prohibited by a 2005 federal law that shields gun manufacturers from liability in most cases when their products are used in crimes.

The plaintiffs include a survivor and relatives of nine people killed in the massacre. They argue the AR-15-style rifle used by shooter Adam Lanza is too dangerous for the public and Remington glorified the weapon in marketing it to young people.

Remington has denied wrongdoing and previously insisted it can’t be sued under the federal law.

The high court majority agreed with most of the lower court’s ruling and dismissed most of the lawsuit’s allegations, but allowed a wrongful marketing claim to proceed.

“The regulation of advertising that threatens the public’s health, safety and morals has long been considered a core exercise of the states’ police powers,” Justice Richard Palmer wrote for the majority.

Lanza, 20, shot his way into the locked school in Newtown on Dec. 14, 2012, and killed 20 first-graders and six educators with a Bushmaster XM15-E2S rifle, similar to an AR-15. He shot his mother to death in their Newtown home beforehand and killed himself as police arrived at the school.

Connecticut’s child advocate said Lanza’s severe and deteriorating mental health problems, his preoccupation with violence and access to his mother’s legal weapons “proved a recipe for mass murder.”

Joshua Koskoff, a lawyer for the plaintiffs, told the state Supreme Court during arguments in November 2017 the Bushmaster rifle and other AR-15-style rifles were designed as military killing machines and should never have been sold to the public.

“The families’ goal has always been to shed light on Remington’s calculated and profit-driven strategy to expand the AR-15 market and court high-risk users, all at the expense of Americans’ safety,” Koskoff said today. “Today’s decision is a critical step toward achieving that goal.”

Military-style rifles have been used in many other mass shootings, including in Las Vegas in October 2017 when 58 people were killed and hundreds more injured.

The case was watched by gun rights supporters and gun control advocates across the country as one that could affect other cases accusing gunmakers of being responsible for mass shootings. Several groups, ranging from the National Rifle Association to emergency room doctors, submitted briefs to the court.

The 2005 federal law, named the Protection of Lawful Commerce in Arms Act, has been cited by other courts that rejected lawsuits against gunmakers and dealers in other high-profile shooting attacks, including the 2012 Colorado movie theater shooting and the Washington, D.C., sniper shootings in 2002.

James Vogts, a lawyer for Remington, has cited the 2005 federal law and previously said the Bushmaster rifle is a legal firearm used by millions of people for hunting, self-defense and target shooting.

Remington, based in Madison, N.C., filed for bankruptcy reorganization last year amid years of slumping sales and legal and financial pressure over the Sandy Hook school massacre.