A strict D.C. gun law that prevents most firearms owners from carrying concealed handguns in public in the nation’s capital is unconstitutional, a federal appeals court panel ruled Tuesday, saying the city government cannot demand citizens prove a “good reason” before being issued permits.

In a 2-1 decision, the U.S. Court of Appeals for the D.C. Circuit ordered lower courts to issue permanent injunctions blocking enforcement of the law.

City officials said they are considering an appeal, but gun rights supporters said the ruling is a major step and could set up an even bigger victory should the U.S. Supreme Court adopt the circuit judges’ decision.

“At the Second Amendment’s core lies the right of responsible citizens to carry firearms for personal self-defense beyond the home, subject to longstanding restrictions,” Judge Thomas B. Griffith wrote in the majority opinion. “These traditional limits include, for instance, licensing requirements, but not bans on carrying in urban areas like D.C. or bans on carrying absent a special need for self-defense.”

The ruling is the latest blow to the District’s efforts to curtail gun possession and use. The Supreme Court struck down the city’s near total ban on firearms possession in 2008, and a federal court blocked an effort to ban the carrying of firearms in public in 2014.

The D.C. Council responded to that ruling with its “good reason” regulations, which require residents to prove they have a “good reason to fear injury” or another “proper reason,” such as a job that requires carrying large amounts of cash or valuables, in order to get a concealed carry permit.

Under the city’s law, living in a high-crime neighborhood was not reason enough to justify approval of a concealed carry permit.

Gun owners said the ban was so restrictive that most law-abiding citizens would be unable to obtain permits.

The regulations also have come under attack by federal lawmakers concerned that they couldn’t carry firearms in the nation’s capital after a gunman in June opened fire on members of Congress during baseball practice in Virginia.

As of June 3, the Metropolitan Police Department reported receiving 606 concealed carry applications, granting 125 permits and denying 403.

“To be sure, the good-reason law leaves each D.C. resident some remote chance of one day carrying in self-defense, but that isn’t the question,” Judge Griffith wrote. “The Second Amendment doesn’t secure a right to have some chance at self-defense. Again, at a minimum the Amendment’s core must protect carrying given the risks and needs typical of law-abiding citizens. That is a right that most D.C. residents can never exercise, by the law’s very design.”

Circuit Court Judge Karen LeCraft Henderson dissented, writing that her fellow judges were stretching gun rights well beyond home protection, which she said was the real core of the Second Amendment.

She said city lawmakers had important government goals that were supported by the law — “the prevention of crime and the promotion of public safety” — that justify its strict licensing scheme.

D.C. Attorney General Karl Racine called the city’s law “a common-sense gun regulation.” He said four other federal appeals courts have ruled in favor of similar restrictions elsewhere.

D.C. Council Chairman Phil Mendelson, who helped craft the original regulations, urged city attorneys to seek a review of the ruling by the full D.C. Circuit — where Democrat-appointed judges hold a 7-4 majority. All three judges who heard the concealed carry cases were appointed by Republican presidents.

“Accepting this without appeal would make the District an outlier among the states, and not in a good way, on this important issue of public safety,” said Mr. Mendelson, at-large Democrat. “I know Second Amendment advocates claim that allowing the possession and carrying of firearms promotes public safety. But all of the gun violence in our city is by people carrying firearms. This is why some regulation — like requiring a good reason to have a license to carry — is necessary.”

Officials from Everytown for Gun Safety, which filed briefs supporting the city’s gun laws, said the ruling leaves D.C. residents and visitors less safe.

Representatives for the Metropolitan Police Department and the office of the D.C. attorney general said the ruling would not take effect immediately. Instead, the city would have a 30-day reprieve to decide whether to ask for an en banc hearing from the D.C. Circuit.

But for Second Amendment advocates, the ruling was cause for celebration.

Alan Gottlieb, founder of the Second Amendment Foundation, which represented three gun owners involved in the case, called the ruling a huge win for gun rights and welcomed the prospect of the case reaching the Supreme Court.

“So far, every time we have gone up against Washington, D.C., we have won. But every time D.C. has appealed, so we expect D.C. to appeal again,” Mr. Gottlieb said.

Charles Cooper, a lawyer who represented gun owner Matthew Grace and the gay gun rights organization Pink Pistols in the case, said the ruling deepens the divide between federal circuit rulings on concealed carry laws, making it more likely that the Supreme Court would take up this case or a similar one on an appeal.

The high court declined this year to take up a closely watched Second Amendment case, Peruta v. California, letting stand a ruling from the 9th U.S. Circuit Court of Appeals that upheld a California law requiring a gun owner to show “good cause” in order to get a permit to carry a concealed handgun in public.

Adam Winkler, a University of California at Los Angeles law professor who has written extensively on the Second Amendment, said the Supreme Court is almost certain to step in if the D.C. Circuit ruling stands. But he is skeptical that an en banc ruling would sustain Tuesday’s decision.

“The D.C. Circuit, in general, has generally read the Second Amendment more narrowly than this opinion did,” he said. “We’ve seen this pattern before, where a court rules in favor of broad concealed carry rights and that decision has been reversed on appeal. I think there is a good chance that will happen here.”