DENVER (Reuters) – A federal judge upheld gun laws on Thursday introduced by Colorado in the wake of deadly shooting rampages there and in Connecticut, dismissing a lawsuit brought by sheriffs, gun shops, outfitters and shooting ranges.

The two laws, passed in 2013 by Colorado’s Democratic-controlled legislature with scant Republican support, banned ammunition magazines that hold more than 15 rounds and required background checks for all private gun sales and transfers.

The bills were introduced in response to a shooting spree in 2012 that killed 12 people at a suburban Denver movie theater, and the slaying later that same year of 20 children and six adults at an elementary School in Newtown, Connecticut.

But they immediately met resistance from critics, including most of Colorado’s elected sheriffs, who said they severely restricted citizens’ constitutional right to own and bear arms.

Last year, voters recalled two key Democratic members of the legislature that approved the controversial measures.

After a two-week civil trial, U.S. District Chief Judge Marcia Krieger ruled the lawsuit lacked standing and said no evidence had been produced which showed limiting magazines to 15 rounds seriously diminished the ability to defend oneself.

“Of the many law enforcement officials called to testify, none were able to identify a single instance in which they were involved where a single civilian fired more than 15 shots in self defense,” she said in her ruling.

Responding to complaints about expanded background checks, she said there were more than 600 firearms dealers in the state which actively perform private checks, and that it takes an average of less than 15 minutes for a check to be run by the Colorado Bureau of Investigation.

Governor John Hickenlooper, a Democrat who signed the bills into law, was named as the defendant in the lawsuit.

Colorado has seen two of the deadliest mass shootings in U.S. history. In addition to the 2012 theater shooting, it was the site of a 1999 massacre at Columbine High School, where two teenagers shot dead a teacher and 12 other students before committing suicide.

But it is also a state where gun ownership is treasured.

Colorado’s Attorney General John Suthers, a Republican, said his office never claimed the laws were “good, wise, or sound policy,” but that it had fulfilled its responsibility to defend the constitutionality of the state law in question.