A Philadelphia police officer shot and killed a home invasion robber who, police say, put a gun to the officer's head as he responded  to a burglary alarm at a Northeast Philadelphia home.

The alarm went off alarm around 12:45 a.m. at the house on the 900 block of Wakeling Street in the Northwood section, police said. A man answered the door when the officer arrived and assured him everything was fine. But when the officer asked him for identification that would show he lived in the house, the man instead brought a woman to the door, police said.

The woman told officers she was fine, and showed identification, but winked at the officer to alert him that something was wrong, police spokesman Lt. John Stanford said. The officer again asked the man for his ID, Stanford said. That's when the man pulled out a handgun and held it to the officer's head, Stanford said.

The officer was able to knock the gun away with his hand - the weapon discharged as he did so - and pull his own weapon, shooting and killing the man, Stanford said. Stanford could not say how many shots were fired. But Captain George Fuchs earlier told reporters at the scene that the suspect fired three shots and officer fired multiple times.

The man was pronounced at the scene by medics at 1:02 a.m.

"This officer, we're lucky we're not planning a funeral," Stanford said. "This officer was sharp enough to recognize this woman was in distress. It was an outstanding job."

Police said a weapon was recovered at the scene.

The man killed by the officer, Stanford said, had targeted the home with an accomplice, waited for the couple who lived there to arrive home and forced them into the house at gunpoint - tripping the burglar alarm as they did so. The second man fled the scene and police were still looking for him, Stanford said. He described the suspect as an Hispanic male, and said police were combing the house for fingerprints and searching the area.

Police also towed away a silver Mazda car.

Stanford said the dead suspect was a 42-year-old man from the 1400 block of St. Vincent Street in Castor. He would not release the man's name, as the department is still working to notify his family, but said he had 12 prior arrests in connection with robbery, firearms violations, receiving stolen property and narcotics offenses.