(Reuters) - A federal judge on Friday upheld a Massachusetts law banning assault weapons including the AR-15, saying the U.S. Constitution’s Second Amendment guarantee of Americans’ right to bear firearms does not cover them.

FILE PHOTO - AR-15 rifles are displayed for sale at the Guntoberfest gun show in Oaks, Pennsylvania, U.S., October 6, 2017. REUTERS/Joshua Roberts

U.S. District Judge William Young in Boston ruled that assault weapons and large capacity magazines covered by the 1998 law were most useful in military service and fall outside the scope of the Second Amendment’s personal right to bear arms.

“In the absence of federal legislation, Massachusetts is free to ban these weapons and large capacity magazines,” Young wrote.

He also rejected a challenge to an enforcement notice Massachusetts Attorney General Maura Healey issued in 2016 to gun manufacturers and dealers clarifying what under the law is a “copy” of an assault weapon like the Colt AR-15.

Healey announced that notice after a gunman killed 49 people at the Pulse nightclub in Orlando, Florida.

Healey welcomed Young’s ruling. “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,” she said in a statement.

The decision came amid renewed attention to gun violence and firearms ownership after a gunman killed 17 students and staff at a Florida high school in February, prompting a surge of gun control activism by teenage students.

Young acknowledged that the plaintiffs had cited the semi-automatic AR-15 rifle’s popularity in arguing the law must be unconstitutional because it would ban a class of firearms Americans had overwhelming chosen for legal purposes.

“Yet the AR-15’s present-day popularity is not constitutionally material,” Young wrote. “This is because the words of our Constitution are not mutable. They mean the same today as they did 227 years ago when the Second Amendment was adopted.”

The Gun Owners’ Action League of Massachusetts, which was among the plaintiffs who sued in 2017, said in a statement that it was concerned by the ruling, which sets a “dangerous precedent.” It said it would consider its next steps.

The U.S. Supreme Court in 2008 held for the first time that the Second Amendment guaranteed an individual’s right to bear arms, but the ruling applied only to firearms kept in the home for self-defense.

The justices have avoided taking another major gun case for eight years. Most recently, in November, the court refused to hear a case challenging Maryland’s 2013 state ban on assault weapons.