When a Philadelphia police officer was ambushed by a gunman who pledged allegiance to the Islamic State, authorities said he was shot with a stolen police firearm. And they said little else.

Now, documents and court records shed light on some of the mystery about that weapon, showing that Officer Jesse Hartnett was critically wounded in January by a Glock reported stolen by a veteran colleague three years earlier.

The gun used to shoot Hartnett, 34, was the department-issue weapon of Officer Leon Pearson, a 26-year-veteran of the department, records show.

In October 2013, Pearson told police he was at his home in Overbrook when he fell asleep, drunk, and awakened to find his gun gone. Nothing else was taken from the house, he said, and there were no signs of forced entry.

Somehow, nearly three years later, his gun made its way into the hands of Edward Archer, who used it to shoot Hartnett at point-blank range as the officer sat alone in his patrol car in West Philadelphia, authorities said.

Hartnett, who was shot three times and critically injured, returned fire and wounded Archer, who was quickly arrested.

The shooting made national news when police said Archer told them he had pledged his allegiance to the Islamic State. Federal authorities have said Archer is not believed to have been part of a terrorist organization.

Archer's lawyer, Trevan Borum, declined to comment as Archer awaits trial on attempted murder and other charges.

Pearson, in a brief interview, declined to discuss the reported theft of his gun and said he had no idea it was later used to shoot a fellow officer.

"I don't know nothing about it," he said. "They didn't tell me about it."

Police Commissioner Richard Ross declined to talk about the police firearm used to shoot Hartnett.

Lt. John Stanford, a police spokesman, would not say what an internal police investigation had concluded about the reported theft of Pearson's gun.

"We don't release internal files," he said.

Records show that Pearson failed to report his gun stolen within 24 hours, as required by department policy. He reported it 48 hours after he said it was taken.

Pearson, 49, who works in the security unit at police headquarters, was disciplined, Stanford said, but he declined to say how.

Addressing reporters after the shooting, Ross said "someone" had been disciplined for the incident but declined to elaborate.

Police documents obtained by the Inquirer and Daily News show that the gun belonged to Pearson. A search warrant executed at Archer's home in West Philadelphia included a reference to a police report taken when the gun he used to shoot Hartnett was reported missing.

The police report, in turn, described Pearson as the victim of a burglary at 11 p.m. on Sept. 29, 2013.

Hartnett did not respond to requests for comment. FOP President John McNesby said the officer is doing well, is newly married and expecting his first child.

"He's recovering and going through the process of getting back to 100 percent," McNesby said.

Kelvyn Anderson, executive director of the Police Advisory Commission, said he was troubled to learn that Pearson had waited two days to report his gun missing and said his agency would review the department's handling of the matter.