California has some of the toughest gun laws in the nation, including a ban on the type of high-capacity ammunition magazines used in some of the nation's deadliest mass shootings.
How long those types of laws will stand is a growing concern among gun control advocates in California and elsewhere.
A federal judiciary that is becoming increasingly conservative under President Donald Trump and the Republican-controlled U.S. Senate has gun control advocates on edge. They worry that federal courts, especially if Trump wins a second term next year and Republicans hold the Senate, will take such an expansive view of Second Amendment rights that they might overturn strict gun control laws enacted in Democratic-leaning states.
The U.S. Supreme Court so far has left plenty of room for states to enact their own gun legislation, said Adam Winkler, a gun policy expert at the University of California, Los Angeles School of Law. But he said the success of the Trump administration in appointing federal judges, including to the high court, could alter that.
"Those judges are likely to be hostile to gun-control measures," Winkler said. "So I think the courts overall have made a shift to the right on guns. We'll just have to see how that plays out."
The legal tug-of-war already is playing out in California.
The state banned the sale of high-capacity ammunition magazines nearly two decades ago as one of its numerous responses to deadly mass shootings; a voter initiative passed three years ago expanded on that, banning all ammunition magazines holding more than 10 rounds even among gun owners who already possessed them.
Earlier this year, a Republican-appointed federal judge overturned the ban, triggering a weeklong bullet buying spree among California gun owners before he put his decision on hold pending appeal. The same judge is overseeing another lawsuit brought by gun-rights groups that seeks to repeal a state law requiring background checks for ammunition buyers.
Legal experts, lawmakers and advocates on both sides said the decision in the case over ammunition limits foreshadows more conflicts between Democratic-leaning states seeking to impose tighter gun laws and an increasingly conservative federal judiciary.
"What you're looking at in the Southern District of California is happening all over the country," said Frank Zimring, a University of California, Berkeley law professor who is an expert on gun laws.
Trump has the opportunity to fill a higher percentage of federal court vacancies than any president at this point in his first term since George H.W. Bush nearly three decades ago.
To date, he has nominated 194 candidates for federal judgeships and has had 146 confirmed, out of 860 total federal district court judicial seats, according to the conservative Heritage Foundation. Of 179 seats on the federal appellate courts, Trump has nominated 46 judges and had 43 confirmed. He is poised to fill 105 vacancies in the district courts and four in the appeals courts, according to the Heritage Foundation.
The changes to the federal judiciary could mean that even gun restrictions that were previously upheld by appointees of former Republican presidents may now be in jeopardy, said Hannah Shearer, litigation director at the San Francisco-based Giffords Law Center to Prevent Gun Violence.
"I think the judiciary is headed into a more extreme place on gun control issues because of President Trump's appointees," she said.
Even when gun and ammunition limits are upheld, those cases eventually could make their way to the U.S. Supreme Court, where Trump may already have tipped the balance.
The court is currently poised to take up its first Second Amendment case in about a decade. It's a challenge to a law New York City passed that prohibited people who have home handgun licenses from taking their guns outside the city for target practice or to a second home.
The city has told the court the case should be dropped, however, because it has relaxed its law.
Among other cases working their way through the courts are challenges to a California ban on certain handguns, other states' longstanding restrictions on carrying concealed weapons and limitations on interstate handgun sales.
Yet forecasting how the Supreme Court might act, or even whether it will take certain cases, is fraught with uncertainty. The court has steered clear of gun-rights cases since establishing an individual right to possess guns in 2008 2010, and has let stand a number of state gun restrictions.
Still, gun-rights supporters are excited by the changes brought by Trump and the Republican-controlled Senate. The upcoming Supreme Court session "could be a real game-changer" with Trump's appointments of Justices Neil Gorsuch and Brett Kavanaugh, said Chuck Michel, an attorney who represents both the National Rifle Association and the affiliated California Rifle & Pistol Association.
"To the extent that the composition of the court has changed and that it will give the Second Amendment back its teeth, it's very important," Michel said. "It looks like there's enough votes on the court right now to reset the standard."
His clients are challenging California's ammunition background check and extended magazine ban before U.S. District Judge Roger Benitez, an appointee of former President George W. Bush.
Other states that limit ammunition magazines in some way, typically between 10 and 20 rounds, are Colorado, Connecticut, Hawaii, Maryland, Massachusetts, New Jersey, New York and Vermont, according to the Giffords Law Center.
Democrats said the prospect of four more years of Trump judicial appointments is helping energize their opposition to his re-election.
"This would be one of the lasting legacies of Donald Trump," said former California state Senate leader Kevin de Leon, a Democrat from Los Angeles who carried or supported many of the state's firearms restrictions, including limits on military-style assault weapons. "When Trump is gone, they will be there for lifetime appointments."
Democratic lawmakers said they will continue pushing more firearms restrictions even as some fear they could be thwarted in the federal courts.
State Sen. Anthony Portantino, a Democrat from Southern California, acknowledges the potential for state gun restrictions to be overturned by federal judges, but said the stakes are too high to back down.
He noted that the gunman who recently killed three people and himself in Gilroy, at an annual garlic festival, was 19 and legally bought his assault-style rifle in Nevada before illegally bringing it into California. The gunman also carried a 75-round drum magazine and multiple 40-round magazines, all banned under California law.
"That he could smuggle that across state lines and kill a 6-year-old, to me that's an example of why we need federal action and why California should continue to lead and tell our story," Portantino said.
He is proposing a ban on anyone buying more than one gun a month and prohibiting almost all gun sales to people under age 21.
Associated Press writer Curt Anderson contributed to this report.