Hattie Louise James was sitting on her front porch in Charlotte when two police detectives emerged from their car. There had been a shooting, they said. Two officers were dead. The gun had been traced back to her.

"I liked to had another heart attack," said the 72-year-old James, a retired hospital worker.

The .32-caliber revolver used to kill Charlotte-Mecklenburg police officers Sean Clark and Jeff Shelton in April 2007 started out as a legally owned weapon. James bought it in 1991 at Hyatt Coin and Gun Shop in Charlotte, but it was stolen a year later from her husband's car. Fifteen years after that, it passed into the hands of 25-year-old Demeatrius Montgomery. This September, Montgomery was convicted of gunning down the officers outside a low-income housing complex in northeast Charlotte.

Clark and Shelton are two of 511 police officers killed by firearms in the United States from the beginning of 2000 through this past Sept. 30. The most recent local death occurred in June, when Maryland State Trooper Wesley Brown was slain while working off-duty at a restaurant in Prince George's County.

Until now, no one has conducted a comprehensive study of how the killers got their guns.

To trace these guns, The Washington Post did a year-long investigation, including building a database of every police officer shot to death in the past decade. (More than 1,900 officers were wounded by firearms during the same period.) Through documents and interviews, The Post was able to track how the suspects obtained their weapons in 341 of the deaths.

This kind of analysis is made more difficult by a law passed by Congress in 2003 that bars federal law enforcement from releasing information that links guns used in crimes back to the original purchasers. To penetrate that secrecy, The Post interviewed more than 350 police officials, prosecutors, defense attorneys, judges, gun dealers, gun buyers, suspects and survivors. In 30 cases, the newspaper obtained confidential firearms traces generated by the Bureau of Alcohol, Tobacco, Firearms and Explosives. The ATF reports track guns recovered at crime scenes back to dealers and original buyers, listing a gun's model, caliber and serial number.

The Post review shows how guns got into the hands of police officers' killers and - in a nation with more than 250 million guns in circulation - how a moment of panic can have deadly consequences.

Among the findings: