A federal judge granted a preliminary injunction on Thursday that blocks California from enforcing their gun magazine confiscation law.

U.S. District Judge Roger T. Benitez said in his ruling that the law, which would make it illegal to possess any gun magazine capable of holding more than 10 rounds of ammunition, likely violates the Second Amendment rights of the plaintiffs in the case. He ordered that California immediately stop enforcing the law pending further legal action.

"The Court does not lightly enjoin a state statute, even on a preliminary basis," Judge Benitez said in the ruling. "However, just as the Court is mindful that a majority of California voters approved Proposition 63 and that the government has a legitimate interest in protecting the public from gun violence, it is equally mindful that the Constitution is a shield from the tyranny of the majority. Plaintiffs' entitlements to enjoy Second Amendment rights and just compensation are not eliminated simply because they possess ‘unpopular' magazines holding more than 10 rounds."

Benitez cited the Supreme Court's landmark Heller ruling in his order and said California's law requiring people to surrender their gun magazines, millions of which are legally owned throughout the United States, did not meet the standard set by that precedent.

"The regulation is neither presumptively legal nor longstanding," Benitez said. "The statute hits close to the core of the Second Amendment and is more than a slight burden. When the simple test of Heller is applied, a test that persons of common intelligence can understand, the statute is adjudged an unconstitutional abridgment."

Judge Benitez went on to say that if the California law were allowed to stand, it would adversely affect millions of California gun owners.

"If this injunction does not issue, hundreds of thousands, if not millions, of otherwise law-abiding citizens will have an untenable choice: become an outlaw or dispossess one’s self of lawfully acquired property," he said in the ruling. "That is a choice they should not have to make. Not on this record."

California attorney general Xavier Becerra said he disagreed with the ruling and would continue to fight for the law in court.

"Proposition 63 was overwhelmingly approved by voters to increase public safety and enhance security in a sensible and constitutional way," Becerra said in a statement on the ruling. "Restricting large capacity magazines and preventing them from ending up in the wrong hands is critical for the well-being of our communities. I will defend the will of California voters because we cannot continue to lose innocent lives due to gun violence."

The National Rifle Association, which supported the suit against the law, said the ruling was a "huge win."

"California’s attempt to ban the possession of standard capacity magazines is unconstitutional and an affront to law-abiding gun owners who have safely, and lawfully owned these tools for decades," Chris Cox, executive director of the National Rifle Association Institute for Legislative Action, said in a statement. "This injunction is a huge win for California gun owners who have long-suffered under a state government hostile to the Second Amendment."