BOSTON - Assault weapons and large-capacity magazines are not protected by the Second Amendment, a federal judge said in a ruling Friday upholding Massachusetts’ ban on the weapons.

U.S. District Judge William Young dismissed a lawsuit challenging the 20-year-old ban, saying assault weapons are military firearms that fall beyond the reach of the constitutional right to “bear arms.”

Regulation of the weapons is a matter of policy, not for the courts, he said.

“Other states are equally free to leave them unregulated and available to their law-abiding citizens,” Young said. “These policy matters are simply not of constitutional moment. Americans are not afraid of bumptious, raucous and robust debate about these matters. We call it democracy.”

Attorney general praises ruling

State Attorney General Maura Healey said the ruling “vindicates the right of the people of Massachusetts to protect themselves from these weapons of war.”

“Strong gun laws save lives, and we will not be intimidated by the gun lobby in our efforts to end the sale of assault weapons and protect our communities and schools,” Healey, a Democrat, said in a statement. “Families across the country should take heart in this victory.”

AR-15 assault-style rifles are under increased scrutiny because of their use in several recent mass shootings, including the February massacre at a Florida high school that left 17 people dead.

Gun owners' lawsuit

The Gun Owners Gun Owners’ Action League of Massachusetts and other groups that filed the lawsuit argued that the AR-15 cannot be considered a “military weapon” because it cannot fire in fully automatic mode.

But Young dismissed that argument, noting that the semi-automatic AR-15’s design is based on guns “that were first manufactured for military purposes” and that the AR-15 is “common and well-known in the military.”

“The AR-15 and its analogs, along with large capacity magazines, are simply not weapons within the original meaning of the individual constitutional right to ‘bear arms,”’ Young wrote.

Young also upheld Healey’s 2016 enforcement notice to gun sellers and manufacturers clarifying what constitutes a “copy” or “duplicate” weapon under the state’s 1998 assault weapon ban, including copies of the Colt AR-15 and the Kalashnikov AK-47.

State law mirrors federal one

Healey’s stepped-up enforcement followed the shooting rampage at a nightclub in Orlando, Florida, that killed 49 patrons. She said at the time that gun manufacturers were circumventing Massachusetts’ ban by selling copycat versions of the weapons they claimed complied with the law.

The Massachusetts assault weapons ban mirrors the federal ban that expired in 2004. It prohibits the sale of specific and name-brand weapons and explicitly bans copies or duplicates of those weapons.

The National Rifle Association panned the ruling and pledged to help the groups fighting the case “in any way possible.”