(Reuters) - A U.S. appeals court on Tuesday blocked a regulation in Washington, D.C., that limited the right to carry a handgun in public to people with a good reason for self-defense, handing a victory to gun rights advocates.

FILE PHOTO: Various automatic handguns are shown in the weapons vault during a media open house at the Alcohol, Tobacco and Firearms (ATF) National Laboratory Center in Beltsville, Maryland June 18, 2013. REUTERS/Gary Cameron/File Photo

The U.S. Court of Appeals for the District of Columbia Circuit’s 2-1 ruling struck down the local government’s third major attempt in 40 years to limit handgun rights in the U.S capital. The decision cited what it said was scant but clear guidance from the U.S. Supreme Court on the right to bear arms.

The District of Columbia may appeal the three-judge panel’s ruling to the full appeals court, potentially a more favorable audience as seven of its 11 members were appointed by Democratic presidents. The three judges in Tuesday’s ruling are Republican appointees.

Mayor Muriel Bowser did not say whether the city would appeal but noted in a statement that similar laws with concealed-carry requirements were in effect in some states.

Judge Thomas Griffith, writing the majority opinion, said constitutional challenges to gun laws “create peculiar puzzles for the courts,” noting that the Supreme Court’s first in-depth review “is younger than the first iPhone.”

That 2008 ruling in District of Columbia v. Heller struck down a D.C. law that banned all handgun possession in the city. It was a major victory for supporters of the Second Amendment to the U.S. Constitution, which protects gun ownership rights.

The city tried again to ban carrying weapons, a law also struck down by the courts in 2014, and is now trying a third time.

Griffith said the Heller ruling made it clear that “the Second Amendment erects some absolute barriers that no gun law may breach.”

Some ambiguity exists because of the first 13 words of the Second Amendment, which reads: “A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.”

Writing in dissent, Judge Karen Henderson cited case law finding the “core” right to bear arms was for self-defense inside the home.

“Regulations restricting public carrying are all the more compelling in a geographically small but heavily populated urban area like the District,” Henderson said.

The National Rifle Association praised the decision.

“Today’s ruling is an important step toward protecting the constitutional rights of law-abiding citizens,” Chris Cox, executive director of the gun rights group’s Institute for Legislative Action, said in a statement.