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

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, citing 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. All three of the panel members involved in Tuesday’s ruling are Republican appointees.

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

That 2008 ruling in a landmark case called 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 council tried again to ban carrying weapons, a law that was also struck down by the courts, and now is trying a third time to restrict the right to carry handguns in the city.

Griffith wrote that the Supreme Court’s Heller ruling made it clear that “the Second Amendment erects some absolute barriers that no gun law may breach.”

Some ambiguity exists due to 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.”

The D.C. law that is being challenged directs the police chief to create rules limiting those who can carry handguns to people showing good reason to need one.

Writing a dissenting opinion, Judge Karen Henderson cited case law finding that the “core” right to bear arms is 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 and the office of D.C. Mayor Muriel Bowser had no immediate comment.

Reporting by Daniel Trotta; Editing by Tom Brown