The federal judge who struck down California’s ban on high-capacity gun magazines is allowing the state to prohibit buying or selling the devices while the state appeals his ruling.

The judge’s latest order ended a multiday run on the magazines around the state, said a lawyer for gun owners who challenged the law, and allowed those who own the magazines to keep them.

“Over the past week, hundreds of thousands of gun owners purchased these self-defense tools that had been unavailable for almost 20 years,” said C.D. Michel, a lawyer for the National Rifle Association and for the plaintiffs in the case. “Gavin Newsom is the magazine salesman of the decade.”

Newsom, as lieutenant governor, sponsored the ballot measure that banned possession of the weapons.

In his order Thursday, U.S. District Judge Roger Benitez of San Diego said that Attorney General Xavier Becerra “has not made a strong showing” that any ban on magazines holding more than 10 bullets is constitutional. But he added that “strong and thoughtful views may be found on both sides” and that his opinion “cuts a less-traveled path” among judges.

California law has forbidden selling, giving away or acquiring large-capacity magazines since 2000. Proposition 63, a 2016 initiative sponsored by Newsom, banned possession of the magazines as well. But Benitez issued an injunction in 2017 that prevented that ban from taking effect, and on March 29 he ruled both the old and new laws unconstitutional.

The judge was unconvinced by researchers, testifying for the state, who said high-capacity weapons had raised the death rolls in mass shootings and were of little use in self-defense. Citing cases in which homeowners had run out of bullets while trying to fend off armed invaders, Benitez said any benefit of requiring a “reloading pause ... in the extremely rare mass shooting incident is vastly outweighed by the harm visited on manifold law-abiding, citizen-victims who must also pause while under attack.”

Magazines holding more than 10 cartridges are “commonly held by law-abiding citizens for defense of self, home and state” and thus are protected by the Second Amendment, Benitez said.

In Thursday’s order, he said allowing the state to continue enforcing its ban on acquiring the weapons would harm many Californians who want to obtain them. But Benitez said his decision to leave that ban in place for now would maintain the status quo while allowing those who have legally acquired the magazines to keep them.

Becerra said he was pleased with the order.

“California leads the nation when it comes to common-sense gun laws,” the attorney general said. “We look forward to defending this important public safety law before the Ninth Circuit and are confident that it is constitutional.”

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com Twitter: @BobEgelko