A federal appeals court in San Francisco ruled Thursday that people do not have a Second Amendment right to carry concealed weapons in public, in a sweeping decision likely to be challenged by gun-rights advocates. 

An 11-judge panel of the 9th U.S. Circuit Court of Appeals issued the 7-4 ruling, upholding a state law requiring applicants to show "good cause," such as a fear of personal safety, to carry a concealed firearm. 

The judges, further, definitively dismissed the argument that a right to carry a concealed weapon was contained in the Second Amendment.

"We hold that the Second Amendment does not preserve or protect a right of a member of the general public to carry concealed firearms in public," Judge William Fletcher wrote in the majority opinion. 

If challenged, it could set up a Supreme Court battle. 

Critics have long charged that the 9th Circuit has a history of liberal-leaning decisions. Thursday's ruling overturns a 2014 ruling by a smaller panel, and resulted from a case in which a sheriff in San Diego County required applicants to show supporting documents, such as restraining orders against attackers, in order to get a permit.

Celebrities who fear for their safety and those who routinely carry large amounts of cash were often given permits.

Judge Consuelo M. Callahan, dissenting in Thursday's ruling, said the restrictions were tantamount to an infringement of the Second Amendment rights of Americans.

“In the context of present-day California law, the Defendant counties’ limited licensing of the right to carry concealed firearms is tantamount to a total ban on the right of an ordinary citizen to carry a firearm in public for self-defense,” Callahan wrote.

“Because the majority eviscerates the Second Amendment right of individuals to keep and bear arms as defined by Heller and reaffirmed in McDonald, I respectfully dissent,” Callahan said.

Gun rights groups blasted the decision.

“Once again the 9th Circuit showed how out of touch it is with mainstream Americans,” C.D. “Chuck” Michel, president of the California Rifle and Pistol Association – one of the plaintiffs in the case -- said in a statement. “This decision will leave good people defenseless, as it completely ignores the fact that law-abiding Californians who reside in counties with hostile sheriffs will now have no means to carry a firearm outside the home for personal protection.” 

The New York-based gun control organization Everytown called the ruling "a major victory for public safety," while California Attorney General Kamala Harris hailed "a victory for public safety and sensible gun safety laws."

During oral arguments before the panel, Paul Clement, an attorney for the plaintiffs, argued that the self-defense standard should be sufficient and asking for more violates the Second Amendment right to bear arms.

California Solicitor General Edward DuMont countered that there was a long and rich tradition of restricting concealed weapons in cities and towns. California officials sought to intervene in the case after the San Diego sheriff declined to appeal.

California officials said loosening concealed weapons permitting standards and allowing more people to carry guns threatens law enforcement officials and endangers the public.

Clement countered that there was no evidence that crime went up in counties such as Fresno and Sacramento that had more permissive "good cause" standards. 

The Associated Press contributed to this report.