An officer in Philadelphia was ambushed by a man who pledged allegiance to the so-called Islamic State (IS), police officials have said.

"According to him, he believed the police defend laws that are contrary to the teachings of Islam," said Richard Ross, Philadelphia's police commissioner.

The police officer returned fire and is in a stable condition despite serious gunshot injuries. The suspect shot the officer with a stolen police firearm but was arrested shortly after by other police.