New York (CNN) -- A federal judge ruled Tuesday that a New York gun law restricting assault weapons and large-capacity magazines was constitutional, but he threw out a provision prohibiting the loading of more than seven rounds of ammunition into a firearm.
Judge William Skretny of U.S. District Court in Buffalo found that parts of the gun-control law -- known as the SAFE Act and enacted by Gov. Andrew Cuomo early in 2013 -- restricting assault weapons and large-capacity magazines did not violate the Second Amendment and met an important governmental interest in public safety.
But the judge ruled that the seven-round limit on ammunition was unconstitutional and "arbitrary," according to the decision.
The law was passed in January 2013 after the mass shooting at a Newtown, Connecticut, elementary school.
Armed with a semi-automatic rifle, gunman Adam Lanza killed 20 first-graders and six school staff members at Sandy Hook Elementary School on December 14, 2012, before taking his own life. Earlier, he killed his mother inside their home.
The New York State Rifle & Pistol Association filed the lawsuit in March, challenging the law's constitutionality.
The association did not immediately return CNN's message seeking comment.