A Philadelphia police officer who was shot and wounded late Thursday was targeted by his assailant in the name of Islam, police said Friday.

“He confessed to committing this act in the name of Islam,” Richard Ross, the city’s police commissioner, said at a news conference Friday.

The suspect, Edward Archer, 30, fired at Officer Jessie Hartnett, 33, and his car 13 times from a semiautomatic pistol, Ross said. Hartnett returned the fire, hitting Archer at least three times, Ross said. He added the gun was a stolen police weapon.

Harnett was hit three times in his left arm. He is in critical, but stable condition at Presbyterian Hospital. Ross called the officer’s injuries “very serious.”

Surveillance video of the incident shows the gunman, wearing a white robe over his clothing, running right up to the police car, putting his gun inside the driver-side window, and firing. He was arrested shortly afterward after running from the scene.

“This is absolutely one of the scariest things I’ve ever seen,” Ross said at the news conference. “This guy tried to execute the police officer. The police officer had no idea he was coming.”

Captain James Clark, the homicide unit commander, said Archer told detectives: “I follow Allah. I pledge my allegiance to the Islamic State. That is why I did what I did.”

But Jim Kenney, the Philadelphia mayor who also spoke at the news conference, downplayed the religious connection.

“This is a criminal with a stolen gun who tried to kill one of our officers,” he said. “It has nothing to do with being a Muslim or following the Islamic faith.” He then repeated those comments on Twitter.

Police did not classify Friday’s attack as a terrorist incident. Philly.com noted that Archer’s mother indicated he is mentally ill. Here’s more:

Reached at her home in Lansdowne, his mother, Valerie Holliday, said Archer was the eldest of seven children and suffered head injuries from playing football and a moped accident.

"He's been acting kind of strange lately. He's been talking to himself . . . laughing and mumbling," Holliday said. "He's been hearing voices in his head. We asked him to get medical help."

She said her son is devout Muslim who has practiced the faith "for a long time."

"He's going through a lot lately," Holliday said, adding Archer believed he was targeted by police.

"I don't know how he got the gun," she said. "I'm still hoping they have the wrong child."

Archer was previously found guilty of forging documents, and, in a separate case, of assault.