The gun used to critically wound Philadelphia Police Officer Jesse Hartnett in an ambush was a police-issued firearm, one of 32 reported lost or stolen in the department in the last five years.
"That is one of the things that you absolutely regret the most, when an officer's gun is stolen and used against one of your own," Police Commissioner Richard Ross said.
The 9mm Glock that Edward Archer allegedly used to shoot Hartnett in January was stolen three years ago, police say.
Of the missing police handguns and rifles, 23 remain unaccounted for, officials said.
Jay Wachtel, a retired investigator with the Bureau of Alcohol, Tobacco, Firearms, and Explosives, said lost and stolen cop guns often end up on the black market, as Hartnett's shooting illustrates.
"To the department, it's very embarrassing because they know these weapons are likely to be misused in shootouts or in holdups," Wachtel said. "It happened to you guys."
Few details could be learned about how the gun was taken. Lt. John Stanford, a police spokesman, would only say that the officer who reported the gun stolen had been disciplined and that he had told investigators the gun had been taken from his home. Stanford would not identify the officer.
The stolen gun is now at the center of the case against Archer, who told police he was a follower of ISIS and shot the officer "in the name of Islam."
Wachtel, who teaches criminal justice at California State University's Fullerton campus, said an officer who loses a weapon can be left anxious for months. He knows about this.
His apartment was burglarized while he was an ATF agent, and his duty gun and badge were stolen.
"I was on pins and needles for three years because I was afraid it would be used in a homicide," Wachtel said. "When it got recovered, I just had this huge sense of relief."
According to Philadelphia police, 27 officers reported their guns stolen and five reported them lost between 2011 and 2015. The force has about 6,100 officers.
Officials with the Los Angeles Police Department, which has about 9,800 officers, said that in the same five years, seven officers on that force reported their guns stolen. None reported their weapons lost.
Among the stolen guns, the department said, four were taken from vehicles, two were taken in thefts, and one was taken in a robbery.
The Baltimore Police Department, a much smaller force with about 2,400 officers, said nine of its officers reported guns stolen between 2011 and 2015. None reported losing a gun.
The Chicago Police Department, which has about 12,000 officers and is nearly double the size of Philadelphia's force, said 73 of its officers reported their guns stolen and four reported their guns lost between 2011 and 2015.
Philadelphia police would not say how many officers had been disciplined over the issue.
Department policy forbids officers from leaving their service weapons behind in their squad cars or personal cars. That rule was violated last year when an officer's entire "rig" - his gun, magazine, and handcuffs - was stolen from his private car, police said.
Jim Burch, vice president for strategic initiatives at the Police Foundation, a Washington-based organization, said understanding the scope of lost and missing police firearms was hampered by a lack of data. He said he was unaware of any federal rule requiring police to collect such information.
Burch said lost firearms were a far more serious problem than stolen ones.
"Preventing the theft of a firearm can be very difficult, particularly when your car and daily attire or uniform essentially advertises to the criminal element that firearms are likely present in your home," he said. "Lost firearms is another matter. . . . Losing a firearm is a very serious issue."
Of the lost firearms reported by Philadelphia police, one was a rifle - an M-16 - that went missing in 2013 from one of the department's gun-storage units.
"We will get to the bottom of it one way or another, I guarantee that," then-Commissioner Charles H. Ramsey said at the time.
But the department has yet to recover that weapon, Stanford said.