A divided panel of the D.C. Court of Appeals refused yesterday to dismiss weapons charges against a bodyguard hired by Sen. Edward M. Kennedy (D-Mass.) who was arrested last year after he asked a U.S. Capitol Police officer to watch his two guns.

It is against the law in the District to carry firearms without a license, but Charles A. Stein Jr., a former police captain in California who now runs a security firm and is licensed to carry a gun there, had argued to the appellate panel that he thought he was following proper procedures by bringing his two semiautomatic weapons to the officer's attention.

In his majority opinion, Judge John A. Terry acknowledged that a person can be immune from prosecution in the District if he voluntarily turns over his gun to a D.C. police officer. But he said the protection did not apply to Stein, who tried to leave his guns for a short time with the U.S. Capitol Police, which is not affiliated with the city's police department.

But in a sharply worded dissent, Judge Julia Cooper Mack called the distinction between the D.C. police and U.S. Capitol Police a "hypertechnical statutory interpretation" that generated an "absurd and harsh result."

"In fact, prosecuting Stein for choosing the wrong police officer to surrender his weapons to only works to discourage other citizens from being so forthcoming in the future," Mack wrote.

The District's strict gun prohibition statute has been the source of some controversy among out-of-towners, in particular private investigators and bodyguards, who frequently are arrested in the District for carrying a weapon that they are licensed elsewhere to have.

Advocates for a change in the law said removing the distinction between U.S. Capitol Police and District police is particularly important because most arrests of people who are licensed elsewhere take place at the Capitol, which frequently has out-of-state visitors, including security personnel. The Capitol Police also cite their security system, which includes metal detectors, as a reason.

"We feel very strongly that it is a quirk in the law that points out the absurdity of the law," said Richard Manning, state liaison officer for the National Rifle Association. Manning said that out-of-state police officers who travel to the District, New Jersey and New York City for extradition hearings are breaking the law if they take their guns and are not licensed in those jurisdictions.

Figures were not available yesterday on the number of arrests on weapons charges at the Capitol, but William Canfield, minority chief counsel for the Senate Rules Committee, said, "It happens fairly often." Canfield said the policy has been particularly upsetting for his boss, Sen. Ted Stevens (R-Alaska), because "everybody in Alaska carries a gun" and people sometimes have forgotten to leave them at home when they visited Stevens' office.

In Stein's case, Kennedy had hired him to accompany him and his sisters on a trip to South America. After his arrest, Stein carried out his duties with weapons provided by U.S. embassies in the countries the Kennedys were visiting.

Stephen Braga, an attorney for Stein, said yesterday that it is likely he will appeal to the full court before Stein stands trial.