A police officer in Philadelphia was shot Thursday night by a man who pledged loyalty to Islam.

Police say Edward Archer, 30, fired at least 11 shots, most at point-blank range (you can see the video above). Amazingly, the officer, Jesse Hartnett, 33, survived. Archer reportedly ambushed Hartnett in his cruiser, but Hartnett still managed to chase him and even shot him before other officers apprehended him.

Philadelphia Police Commissioner Richard Ross Jr. said Archer "confessed to committing this cowardly act in the name of Islam" and other officials say he admitted to pledging allegiance to ISIS.

Archer, who has previously been arrested on weapons and assault charges, also reportedly said police enforce laws that do not go in line with the Koran.

Archer's mother told the Philadelphia Inquirer her son may have suffer from mental illness.

As for Hartnett, Ross said, "I just have to tell you, when you look at the video -- we have video that captured all of this -- it's one of the scariest things I've ever seen. This guy tried to execute the police officer. It's amazing he's alive." He's listed in critical, but stable, condition.

His father said they've actually been able to talk after the incident, adding, "I love him and very proud of him. He's an excellent person."

More From 107.9 LITE FM