Both the officer and suspect were injured during the barrage of gunfire, AP Reports.
The suspect, 30-year-old Edward Archer, also pledged allegiance to the so-called “Islamic State” terrorist group when he was questioned after his arrest in the shooting late Thursday, police said.
The shooting of Officer Jesse Hartnett was an attempted assassination, Police Commissioner Richard Ross said.
Archer's mother, Valerie Holliday, told The Philadelphia Inquirer he has been hearing voices recently and that family asked him to get help.
The gunman fired at least 13 shots toward Hartnett and eventually got up next to the car and reached through the driver's-side window. Despite being seriously wounded, Hartnett got out of his car, chased the suspect and returned fire, wounding his attacker.
Hartnett, 33, was in stable condition. Archer was treated and released into police custody.
The gun used by Archer was stolen from an officer's home in 2013, police said.
Officials said they were trying to figure how Archer got the weapon and whether it passed through other people's hands in the time since the theft.