A gunman claiming to have pledged allegiance to Islamic State militants shot and seriously wounded a Philadelphia police officer in an ambush on his patrol car, the city's police commissioner said on Friday.

Edward Archer of Philadelphia approached Officer Jesse Hartnett, 33, shortly before midnight and fired 11 rounds, three of which hit the officer in one arm, authorities said. Police released images from surveillance video that showed the gunman dressed in a long white robe walking toward the car and firing, eventually getting close enough to shoot directly through the window.

Hartnett chased Archer, who was arrested by responding officers and later confessed to the attack, saying he had carried it out "in the name of Islam," police officials told reporters.