(Reuters) - A federal appeals court on Friday upheld the constitutionality of two California laws restricting the ability of people to buy and carry firearms, rejecting appeals by gun rights advocates.

FILE PHOTO: A Browning gun is surrendered during a gun buyback event at Los Angeles Sports Arena in Los Angeles, California May 31, 2014. REUTERS/Kevork Djansezian

The 9th U.S. Circuit Court of Appeals rejected challenges to Unsafe Handgun Act requirements that new semiautomatic pistols have chamber load indicators and magazine detachment mechanisms, both meant to limit accidental discharges, and microstamp their makes, models and serial numbers onto fired shell casings.

A different panel of the same court upheld a 2015 amendment to California’s Gun-Free School Zone Act that forbade concealed carry permit holders from possessing firearms on school grounds, while letting retired police and other “peace” officers do so.

Gun rights advocates said the handgun law violated their Second Amendment rights, and that both laws violated their Fourteenth Amendment equal protection rights.

Lawyers for the plaintiffs did not immediately respond to requests for comment. The office of California Attorney General Xavier Becerra, which defended the laws, did not immediately respond to a similar request.

California has some of the nation’s most restrictive gun laws. Becerra was among 19 state attorneys general this week to call on the Trump administration to block a private company’s planned online release of 3-D printed gun blueprints.

In the Unsafe Handgun Act decision, Circuit Judge Margaret McKeown wrote for a 2-1 majority that requiring new handguns to contain “modern technology” did not impose a substantial burden on gun buyers, and reasonably related to California’s interests in protecting public safety and tracing bullets at crime scenes.

Circuit Judge Jay Bybee dissented on the microstamping provision, saying in a 51-page opinion the plaintiffs’ Second Amendment claims should be taken “seriously.”

He said California’s “restrictive testing protocol” had since 2013 barred commercial sales of new handguns, allowing sales only of guns grandfathered from microstamping, and it was premature to say microstamping reasonably fit with California’s interest in solving handgun crimes.

In the 3-0 schools decision, Circuit Judge John Owens said California could rationally decide that retired peace officers could have firearms on school grounds for self-protection, based on their prior exposure to crime, and protect public safety.

He rejected a claim that the 2015 amendment was enacted to favor “politically powerful” retired officers and harm “politically unpopular” concealed carry permit holders.