In a 2-1 decision, the judges held that the activities protected by the Second Amendment "are not limited to militia service, nor is an individual's enjoyment of the right contingent" on enrollment in a militia.
The U.S. Court of Appeals for the District of Columbia Circuit ruled that the city cannot prevent people from keeping handguns in their homes. The ruling also struck down a requirement that owners of registered firearms must keep them unloaded and disassembled. The court did not address provisions that prohibit people from carrying unregistered guns outside the home.
D.C. Mayor Adrian Fenty said the city plans to appeal.
"I am personally, deeply disappointed and quite frankly outraged," Fenty said.
Washington and Chicago are the only two major U.S. cities with sweeping handgun bans. Washington's ban on owning handguns went into effect in 1976 and is considered to be the toughest in the nation, according to the National Rifle Association. While courts in other parts of the country have upheld bans on automatic weapons and sawed-off shotguns, the D.C. law is unusual because it involves a prohibition on all pistols.
In 2004, a lower-court judge told six city residents that they did not have a constitutional right to own handguns. The plaintiffs include residents of high-crime neighborhoods who wanted the guns for protection.
Plaintiff Tom G. Palmer told CBS News Radio he's thrilled with the ruling. Palmer said having a gun when he was attacked in California years ago saved his life.
"I am quite confident that had I not had that gun, you and I would certainly not be having this conversation," Palmer told reporter Kate Ryan.
On Friday, Judge Laurence Silberman, writing for the majority, said "The district's definition of the militia is just too narrow. There are too many instances of 'bear arms' indicating private use to conclude that the drafters intended only a military sense."
Judge Karen Henderson dissented, writing that the Second Amendment does not apply to the District of Columbia because it is not a state.
The Bush administration has endorsed individual gun-ownership rights, but the Supreme Court has never settled the issue. If the dispute makes it to the high court, it would be the first case in nearly 70 years to address the Second Amendment's scope.
"I think this is well positioned for review of the Supreme Court," said Jonathan Turley, a constitutional law professor at George Washington University.
Even as the appeals court overturned the city's 1976 ban on most handgun ownership, Silberman wrote that the Second Amendment is still "subject to the same sort of reasonable restrictions that have been recognized as limiting, for instance, the First Amendment."
Such restrictions might include gun registration, firearms testing to promote public safety or restrictions on gun ownership for criminals or those deemed mentally ill.