Massachusetts is now joining a handful of other states that are trying to regulate the do-it-yourself firearms known as ghost guns.

The guns, which lack serial numbers and are extremely difficult to trace, are put together with parts that come in kits or as separately purchased, mix-and-matchable pieces. Gov. Maura Healey signed a law Thursday that requires all guns to have serial numbers issued through a forthcoming request system that the Executive Office of Public Safety and Security and the Department of Criminal Justice Information Services will design.

“This law will save lives, and I’m grateful to the Legislature and gun safety advocates for their hard work to see this through,” Healey said in a statement announcing her signature.

According to researchers with the gun violence prevention group Everytown for Gun Safety, 14 states have already passed laws requiring guns to be serialized.

Gun violence activists celebrated the law, which also bans guns from government buildings and polling places.

“This is a great day for Grassroots for Gun Violence Prevention volunteers who’ve worked so hard to support this bill’s passage as part of our mission to free all communities from gun violence,” said Rina Schneur, founding volunteer of the group Grassroots for Gun Violence Prevention, adding that the bill “will protect our communities from the plague of ghost guns that are increasingly used in crimes, will limit firearms trafficking, and will prohibit gun carry in sensitive locations.”

To help address ghost guns, the bill defines a gun frame — the part of a revolver or handgun that connects all of its components — as a firearm, a change state Rep. Michael Day said would address an existing gap in state law and empower police to charge people who traffic the guns.

“When we met with law enforcement, they told us these were the tools they needed,” he told GBH News. “Often what was happening is that you went into a residence, or a spot where all of these parts were laying around, and [police] were unable to charge [people with gun components] with the illegal possession of a firearm.”

The bill would also make the manufacture, sale or assembly of an untraceable ghost gun punishable by imprisonment for at least one year.

The legislation comes nearly two years after a U.S. Supreme Court ruling nullified Massachusetts’ rules guiding gun licensure. Lawmakers vowed to update the state’s laws as part of their response to the ruling.

Asked how confident he is that lawful gun owners would comply with the serial number mandate, Day responded, “I guess I question why an individual would want to purchase an untraceable gun, if they consider themselves a lawful and responsible gun owner. The real problem here with untraceable guns is they’re just on the streets and terrorize our neighborhoods.”

While it is difficult to know how many of the firearms are in circulation, the Bureau of Alcohol, Tobacco, Firearms and Explosives reports that between 2016 and 2021, law enforcement agencies recovered more than 45,000 suspected ghost guns from potential crime scenes nationwide.

The guns have proliferated locally, too.

In Boston, ghost guns represented about 10% of the 872 firearms recovered by Boston Police last year.

Statewide, the Massachusetts State Police Commonwealth Fusion Center reports that ghost gun seizures went up 57%, from 168 in 2021, the first year the agency began formally collecting the data, to 304 seized in 2023.

Ghost guns’ growing presence has been aided by the rise of open-source 3D-printing blueprints and milling machines made to produce gun parts.

Shipping companies like UPS and FedEx have tightened their rules on mailing guns and gun parts in the last several years. Neither company ships ghost guns, making them harder to get.

Still, Second Amendment advocates are doubtful the new law will survive a legal challenge.

Cody Wilson, co-founder of the Austin-based company Defense Distributed, described the legislation as “insane.”

“Good luck,” he said with a laugh, adding that California has pursued similar attempts to regulate ghost guns and their components. 

The Massachusetts law also bans using 3D printers or similar machines to make guns unless the person is licensed to carry. It places specific restrictions on the sale of gun-milling machines, including 3D printers, to keep them from being sold if the “primary or intended function” is to make guns.

Wilson, who’s had his own troubles with the law has played a prominent role in the dissemination of ghost guns, and is credited with debuting the world’s first fully 3D-printed gun. He says the law, when it comes to self-assembled guns, is particularly complex .

“You’ve made it to where it’s like you need a license to use a bicycle,” he said. “This is just a cynical way of saying anybody who sells gun parts and can teach you how to make gun parts on a 3D printer is not allow to sell 3D printers to people in Massachusetts,” which Wilson argued is a First Amendment violation.

Massachusetts’ new law expands who can ask for an extreme risk protection order — the so-called red flag law procedure that allows family members, significant others and police departments to confiscate guns from people who pose a risk to themselves or others. Now, school administrators, police and health care professionals who have treated a person within the last six months are eligible to ask a court for gun removal.

It would provide for information sharing between the Departments of Public Health, Mental Health and Criminal Justice Information Services “so that our local licensing authorities will know about the mental health [gun license] applicants may be facing,” Day said on the House floor earlier this month.

The law also mandates a new, extensive public dashboard that would show a range of gun-related information, including demographic data about gun license applicants and application denials, guns used in criminal incidents and whether gun-users were arrested in connection with the listed incidents.