This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

PHILADELPHIA – The man suspected of shooting and injuring a Philadelphia police officer Thursday night confessed that he did so in the name of Islam, Philadelphia Police Commissioner Richard Ross Jr. told reporters Friday.

Philadelphia police say the suspect professed his allegiance to ISIS and said he shot the officer for Islam. (Handout)

Officer Jesse Hartnett, 33, was driving through West Philadelphia around 11:45 p.m. Thursday, when a gunman started unleashing a hail of bullets.

The suspect, 30-year-old Edward Archer, dressed in a white tunic, ran up to the patrol car and fired at least 13 times, emptying his 9mm handgun, police said.  At one point, Archer could be seen in surveillance images with both arms inside the patrol car as he appeared to fire directly into Hartnett, according to officials.

During questioning the suspect pledged his allegiance to the Islamic State and said that he did it for Islam, according to officials.

Edward Archer, 30.

Archer said he believed police defended laws that were contrary to his religion, according to Richard Ross, Philadelphia’s police commissioner.  Valerie Holliday, Archer’s mother, described him as a devout Muslim, but told the Philadelphia Enquirer that he had been hearing voices recently and that her family had urged him to get help.

Officials also confirmed Friday afternoon that the gun used in the shooting was a police firearm.  Police say the weapon was stolen from a police officer’s home in October, 2013, but it’s not known how it allegedly ended up in Archer’s possession.

“This guy tried to execute the officer,” said Ross.

“This is absolutely one of the scariest things I’ve ever seen,” Ross said.

Hartnett, a five-year veteran of the PPD, was struck three times in his left arm and suffered a broken arm and nerve damage during the incident.

“It’s amazing he was able to survive,” Ross said of Harnett who is undergoing surgery at Penn Presbyterian Hospital Friday morning.

During the shooting, the Archer was so close to the police car that he squeezed off a few shots from inside the car’s driver side window, Ross said.

Incredibly, Hartnett returned fire striking the suspect at least once in the buttock, police said.

 CNN contributed to this report.