A federal judge blocked a California gun law on Thursday that required people to undergo a background check before purchasing ammunition.

U.S. District Judge Roger Benitez in San Diego called the regulations "onerous and convoluted," adding that they violate a citizen's Second Amendment rights, the Associated Press reported.

Benitez ruled in favor of the California Rifle & Pistol Association, which had asked him to halt the background checks with a preliminary injunction.

"The experiment has been tried. The casualties have been counted. California's new ammunition background check law misfires and the Second Amendment rights of California citizens have been gravely injured," Benitez wrote in his 120-page opinion.

STEVE DAINES' PRO-SECOND AMENDMENT BILL AIMS TO PROTECT LAW-ABIDING GUN OWNERS TAKING FIREARMS ACROSS STATE LINES

"Criminals, tyrants, and terrorists don't do background checks," he added. "The background check experiment defies common sense while unduly and severely burdening the Second Amendment rights of every responsible, gun-owning citizen desiring to lawfully buy ammunition."

Benitez reportedly claimed the law blocked legitimate sales to law-abiding citizens, about 16 percent of the time. He also ruled that California's ban on importing ammo from outside the state violates federal interstate commerce laws.

California became the first state in the country to require background checks for ammo purchases when the law took effect back in July.

Ammunition sales jumped 300 percent in June before the regulations took effect. Voters originally approved the measure back in 2016

CLICK HERE TO GET THE FOX NEWS APP

The state attorney general's office told the AP it is reviewing the decision but did not immediately say if it would appeal the decision or not.

Fox News' Brie Stimson contributed to this report