Police say a Philadelphia police officer is expected to survive after he was shot multiple times in an ambush-style attack. (Reuters)

The 30-year-old man investigators say ambushed and shot a Philadelphia police officer, then later proclaimed his loyalty to the Islamic State, was charged Saturday with attempted murder.

Court documents show that Edward Archer, of Yeadon, Pa., also faces an array of other charges, including aggravated assault, assault of a law enforcement officer, reckless endangerment and carrying a firearm without a license. A judge has denied Archer bail, pending a preliminary court hearing scheduled for Jan. 25.

The official charges came less than two days after Archer’s brazen attack late Thursday on Officer Jesse Hartnett near a quiet West Philadelphia intersection.  Authorities say Archer fired at least 13 shots into Hartnett’s patrol car, seriously wounding him. The 33-year-old officer, who later underwent emergency surgery for his injuries, was able to return fire, and officers apprehended Archer nearby.

Investigators said Archer used a stolen police gun to carry out the attack, which was captured on surveillance video. He later “confessed to committing this cowardly act in the name of Islam,” Richard Ross Jr., the city’s police commissioner, said at a news conference on Friday. Police also said Archer had declared his loyalty to the Islamic State, also known as ISIS or ISIL, and told detectives that the attack was warranted because police enforce laws that are contrary to the teachings of the Koran.

[Obama administration plans shake-up in propaganda war against the Islamic State]

“He stated that he pledges his allegiance to Islamic State, he follows Allah and that is the reason he was called upon to do this,” Capt. James Clark said at Friday’s news conference. “He kept on echoing those sentiments and he wouldn’t give us anything more than that.”

The shooting in Philadelphia comes at a time of heightened fears about terrorism nationwide, occurring barely a month after a husband-and-wife pair in San Bernardino, Calif., killed 14 people in what was later deemed a terror attack.

Hours before the shooting in Philadelphia, federal prosecutors announced that two Palestinian men who were born in Iraq and came to the United States as refugees had been charged as part of terrorism investigations.

Philadelphia Mayor Jim Kenney (D) said Archer did “not represent” Islam and denounced the attacker’s invocation of the faith. “This is a criminal with a stolen gun who tried to kill one of our officers,” Kenney said Friday. “This has nothing to do with being a Muslim or following the Islamic faith.”

Other Muslim groups also have denounced the attack.

The FBI said is assisting the Philadelphia Police Department in the investigation, with the local police leading the probe. Authorities have said they are looking into trips Archer had taken to the Middle East — he traveled to Saudi Arabia in October and November of 2011 and went to Egypt for several months in 2012, an FBI spokesman said Friday evening. It was not clear how Archer obtained the gun, which was reported stolen from an officer’s home in 2013, Ross said.

Court records show that Archer had been charged with aggravated assault, terroristic threats and other offenses for an incident in 2012. Last year, he pleaded guilty to charges of simple assault and carrying a firearm without a license.

Archer’s mother, Valerie Holliday, told the Philadelphia Inquirer that her son was a devout Muslim who had suffered head injuries.

“He’s been acting kind of strange lately,” she said. “He’s been talking to himself…He’s been hearing voices in his head. We asked him to get medical help.”

It remains unclear what, if any, actual ties or exposure Archer might have had to the Islamic State.

Mark Berman contributed to this report.