A gunman who pledged allegiance to ISIS ambushed a Philadelphia police officer Thursday night, unleashing a hail of bullets at him "in the name of Islam," officials said.
The suspect, Edward Archer, 30, now in custody, "confessed to committing this cowardly act in the name of Islam," Philadelphia Police Commissioner Richard Ross said during a news conference. "According to him, he believed that the police defend laws that are contrary to the teachings of the Quran."
Philadelphia Police Captain James Clark said the suspect "stated that he pledges his allegiance to Islamic State, he follows Allah and that is the reason he was called upon to do this."
The suspect used a stolen police firearm and fired shots at close-range at Officer Jesse Hartnett while he was in his police vehicle Thursday night, police said. The weapon was stolen in 2013, police said.
"You can see the male in question going toward police officer Hartnett. ... He is literally inside that car," Ross said today of an image of the shooting.
The gunman fired at least 11 shots, seriously wounding the cop, and then fled, authorities said today. Harnett, a 4-year veteran of the department, got out of his car and chased the gunman, firing back at him.
"His will to live undoubtedly saved his life," Ross said.
Hartnett, 33, was shot three times, Ross said, noting he suffered serious injuries that will require multiple surgeries. He was in critical but stable condition, police said.
"This could have easily been a police funeral," said Ross.
Archer is from Yeadon, Pennsylvania -- about 25 minutes outside of Philadelphia -- and has one prior arrest, police said. He was hospitalized to be treated for a gunshot wound, police said.
Archer traveled twice from New York-area airports to the Middle East -- to Saudi Arabia in 2011 for Hajj and to Egypt in 2012, two law enforcement sources told ABC News. Archer has a U.S. passport and was not on a watch list, the sources said. The FBI, who is assisting Philadelphia police with the investigation, will look at whether his travels could have played a role in the shooting, the sources said.
This was the first police-involved shooting for the administration of Philadelphia Mayor Jim Kenney, who was inaugurated four days ago.
Kenney said today of the shooting, "It's terrible and it does not represent the religion [Islam] in any way shape or form or any of its teachings."
"This is a criminal with a stolen gun who tried to kill one of our officers," Kenney said. "Has nothing to do with being a Muslim or following the Islamic faith."
The FBI is assisting Philadelphia police with the investigation.
Sen. Bob Casey, D-Pennsylvania, praised Hartnett for showing "an awe inspiring level of bravery and heroism," and also promised: "Those who carry out attacks in the name of ISIS or any other terrorist organization must be fully prosecuted."
"This individual and any who would advocate similar acts are not representative of any religion -- they are thugs, and criminals," Casey said in a statement. "We have to take every appropriate step to safeguard our communities and ensure safety, while also targeting and destroying terrorists."
Meanwhile in New York, the NYPD issued an "Officer Safety Alert" mentioning attacks the Philadelphia shooting and a recent knife attack on police in Paris.
"These two incidents demonstrate the continued threat that members of service face from individuals seeking to target law enforcement personnel for a variety of reasons, including terrorist motivations," the alert said. "Members of service are reminded that ISIL has called for its supporters and sympathized in the United States to carry out attacks, specifically mentioning law enforcement, military, and intelligence personnel as priority targets."
ISIS is also known as ISIL or the Islamic State.
The alert said all members of service "should be aware that individuals plotting to carry out attacks may be armed and may decide to expedite an attack when engaged or confronted by law enforcement personnel."