A federal judge struck down a California law which bans gun owners from having detachable magazines that carry over 10 rounds.

U.S. District Judge Roger Benitez issued the ruling on Friday, but the ruling won't take effect immediately. Benitez had already struck down the ban on certain magazines in 2017, but an appeals court reversed the decision.

In his ruling, Benitez wrote "there is no American tradition of limiting ammunition capacity," adding that detachable magazines "solved a problem with historic firearms: running out of ammunition and having to slowly reload a gun."

"There have been, and there will be, times where many more than 10 rounds are needed to stop attackers," Benitez wrote in the ruling. "Yet, under this statute, the State says ‘too bad.’"

NEWSOM VETOES BILL THAT WOULD REQUIRE PARENTS TO AFFIRM CHILD'S GENDER IDENTITY IN CUSTODY BATTLES

Firearms on display at Oregon gun store

FILE - Firearms are displayed at a gun shop in Oregon., on Feb. 19, 2021. (AP Photo/Andrew Selsky, File) (AP Photo/Andrew Selsky, File)

California Attorney General Rob Bonta quickly filed a notice of appeal, and the ban will likely remain in place while the law works its way through the courts.

California AG speaks to reporters wearing a suit

FILE - California Attorney General Rob Bonta speaks at a news conference at the Capitol in Sacramento, Calif., Feb. 23, 2022.  ((AP Photo/Rich Pedroncelli, File))

"We believe that the district court got this wrong," Bonta said. "We will move quickly to correct this incredibly dangerous mistake."

California Governor Gavin Newsom also quickly criticized the decision, attacking the federal judge on social media.

"BREAKING: California's high-capacity magazine ban was just STRUCK DOWN by Judge Benitez, an extremist, right-wing zealot with no regard to human life. Wake up, America," Newsom wrote on a post on X, formerly known as Twitter. "Our gun safety laws will continue to be thrown out by NRA-owned federal judges until we pass a Constitutional Amendment to protect our kids and end the gun violence epidemic in America."

NEWLY AMENDED CALIFORNIA BILL COULD PUNISH PARENTS REFUSING TO ‘AFFIRM’ CHILD'S GENDER IDENTITY

Newsom smirks at news conference in Sacramento

FILE – California Gov. Gavin Newsom speaks  at a news conference in Sacramento, Calif., Thursday, March 16, 2023. On Thursday, March 30, 2023, Newsom announced a new political action committee he says will boost Democrats in Republican-led states.  (AP Photo/Rich Pedroncelli)

CLICK HERE TO GET THE FOX NEWS APP

Chuck Michel, president of the California Rifle and Pistol Association, said the decision by Benitez was "thoughtful and in-depth approach."

"Sure, the state will appeal, but the clock is ticking on laws that violate the Constitution," Michel said.

The Associated Press contributed to this report.