A 30-year-old man accused of firing at least 11 times at a Philadelphia police officer had pledged allegiance to ISIS, police said today.

The gunman, now in custody, “confessed to committing this cowardly act in the name of Islam,” Philadelphia Police Commissioner Richard Ross said during a news conference.

PHOTO: Officials say a suspect fired 13 shots at Philadelphia police officer Jesse Hartnett while he was in his police vehicle.

“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, who’s name was not released at the news conference, “stated that he pledges his allegiance to Islamic State, he follows Allah and that is the reason he was called upon to do this.”

PHOTO: Officials say a suspect fired 13 shots at Philadelphia police officer Jesse Hartnett while he was in his police vehicle.

Officials said the suspect used a stolen police firearm when he fired shots at close-range at Officer Jesse Hartnett while he was in his police vehicle Thursday night.

TRENDING ON REVIVE AMERICA

Sorry. No data so far.

The weapon was stolen in 2013, police said.

PHOTO: Officials say a suspect fired 13 shots at Philadelphia police officer Jesse Hartnett while he was in his police vehicle.

“You can see the male in question going toward police officer Harnett. … He is literally inside that car,” Ross said today of an image of the shooting.

Harnett then got out of his car and fired back.

“His will to live undoubtedly saved his life,” Ross said.

Hartnett was shot three times, Ross said, noting he suffered serious injuries that will require multiple surgeries.

“This could have easily been a police funeral,” said Ross.

PHOTO: Officers investigate the scene of a shooting, Jan. 8, 2016, in Philadelphia.

Source: Mexico recaptures druglord ‘El Chapo’