A federal judge ruled Tuesday that New York’s expanded ban on assault weapons and high-capacity magazines was constitutional, but he struck down a provision forbidding gun owners from loading their firearms with more than seven rounds, which he called “an arbitrary restriction” that violates the Second Amendment.

According to a New York Times report, Judge William M. Skretny of Federal District Court in Buffalo said the greater restrictions on assault weapons and high-capacity magazines were constitutional because they served to “further the state’s important interest in public safety.”

The new legislation was passed in January 2013 in response to the mass shooting at Sandy Hook Elementary School in Newtown, Conn.