A federal judge on Tuesday upheld a Maryland ban on 45 assault weapons and a limit on gun magazines to 10 rounds, two key parts of a sweeping gun-control law that were challenged shortly before the law went into effect last year.

Maryland lawmakers approved the measure in response to the December 2012 shootings at Sandy Hook Elementary School in Newtown, Connecticut, that killed 20 children and six educators.

U.S. District Judge Catherine Blake concluded in a 47-page ruling that the law serves the government's interest in protecting public safety without significantly burdening what the Supreme Court has explained is the core Second Amendment right of "law abiding, responsible citizens to use arms in defense of hearth and home."

"In summary, the Firearms Safety Act of 2013, which represents the considered judgment of this state's legislature and its governor, seeks to address a serious risk of harm to law enforcement officers and the public from the greater power to injure and kill presented by assault weapons and large capacity magazines," Blake wrote in her ruling.

Democratic Gov. Martin O'Malley proposed the measure, which one of the nation's strictest. It went into effect in October.

"We're pleased the court upheld the law we passed to reduce gun violence," said O'Malley spokeswoman Nina Smith. "The Firearms Safety Act is just one part of the reason that, working with law enforcement, we've driven down violent crime in Maryland to the lowest rate in 40 years."

John Parker Sweeney, an attorney representing groups that opposed the law, argued last month in U.S. District Court in Baltimore that the state went too far and banned popular firearms that can be used for self-defense. Attorneys for the state countered that the law protects the public and took a reasonable approach by focusing on firearms used in military-assault style attacks and mass shootings.

Blake noted in her ruling that with the exception of one example not relevant to the case, Maryland law enforcement officials are unaware of any resident using an assault weapon or needing to fire more than 10 rounds in self-defense. The exception was a case in Baltimore city in which a civilian fired more than 10 rounds in a self-defense incident, but as the perpetrators were fleeing the scene.

Blake also rejected the plaintiffs' contention that assault weapons are used infrequently in mass shootings and murders of law enforcement officers.

"As for their claims that assault weapons are well-suited for self-defense, the plaintiffs proffer no evidence beyond their desire to possess assault weapons for self-defense in the home that they are in fact commonly used, or possessed, for that purpose," Blake wrote.

The law contains a variety of other provisions. They include a licensing requirement for handgun purchasers to submit fingerprints to the state police in an effort to reduce the number of guns purchased by a friend or family member for someone who is not allowed to own a gun.