Americans have no Second Amendment right to carry concealed guns in public, a federal appeals court in California ruled on Thursday in a significant blow to gun-rights activists and gun owners in a large swath of the Western U.S.

The San Francisco-based Ninth U.S. Circuit Court of Appeals, in a 7-4 ruling, upheld a California law requiring residents to show “good cause” for carrying a concealed handgun.

Under...