Richard Ross, the police commissioner of Philadelphia, revealed at a press conference that the suspect, 30-year-old Edward Archer, said he had pledged allegiance to IS and committed the act in the name of Islam.

The shooting, in which the gunman fired at least 13 shots at the officer, was called an assassination attempt.

It was also revealed during the press conference that the weapon used in the attack was a police firearm reported stolen in Oct. 2013.

According to The Associated Press, Archer's mother, Valerie Holliday, told The Philadelphia Inquirer he has been hearing voices recently and that family asked him to get help. She said her son was a devout Muslim.

The officer is in stable condition.

7:15 a.m.

A Philadelphia officer was the victim of an ambush attack in which 13 bullets were fired into his vehicle late Thursday night.

The officer, 33-year-old Jesse Hartnett, was hit three times but survived the attack, according to WPVI-TV.

He suffered a broken arm and underwent surgery overnight, but was awake and alert before the procedure.

>> Read more trending stories

Hartnett fired back at the suspect and struck him three times, police said. He was taken to University of Pennsylvania hospital.

Hartnett is a 5-year veteran of the force, according to WPVI-TV.

"It's amazing he was able to survive," Police Commissioner Richard Ross said to the station.

The Associated Press contributed to this report.