A man accused of ambushing a Philadelphia police officer with a hail of gunfire in the name of the Islamic State group refused to cooperate at the start of his attempted murder trial Thursday, telling a judge that he won't "plead to anyone but Allah."

With his back to a crowd of officers that included the city's police commissioner, Edward Archer, 32, offered the same response again and again as each charge stemming from the 2016 shooting was read aloud.

"Respectfully, your honor, I don't plead to anyone but Allah," Archer said.

At the request of the judge, pleas of not guilty were entered and prosecutors began their work.

"Make no mistake about it, Edward Archer was a man with a plan that night," Assistant District Attorney Jan McDermott said, adding that he was "lying in wait" with an illegal handgun, gloves and a scarf around his face.

McDermott told jurors that Archer rushed toward Officer Jesse Hartnett with a handgun drawn as the policeman rolled through a west Philadelphia intersection in his police cruiser. Archer fired 13 bullets, three of which shattered bones and damaged nerves in Hartnett's arm. Hartnett, who required multiple surgeries after the shooting, still managed to shoot back at the attacker, striking him once in the buttocks, the prosecutor said.

"This case is about two men: Officer Jesse Hartnett and the man who tried to murder him, Edward Archer," McDermott said.

Archer's lawyer countered in a brief opening statement that mainly focused on the fact that defendants are presumed innocent until proven guilty.

Jurors then watched a surveillance video that showed a person in an all-white gown unloading a handgun into the driver's side of a squad car. The gunshots, pointed out by a detective who noted the small flashes of light from the muzzle of the firearm, were let off in rapid succession as the person approached closer and closer until their hands appeared to be inside the shattered window of the vehicle.

The shooter fled, according to the video, and was followed on foot by a wounded Hartnett. Archer was arrested only a few blocks away, authorities said.

When prosecutors played the frantic police radio chatter that followed the shooting, a woman in a front row of the courtroom gallery began sobbing. A clerk passed a box of tissues in her direction.

"I'm shot! I'm bleeding heavily," Hartnett could be heard saying over the radio recording.

A gasp was heard when images of the blood-splashed car doors and crosswalk were displayed on the court's flat-screen TVs.

Archer's links to the Islamic State group remain unclear.

After Archer's arrest, a police official told reporters that the suspect said "I follow Allah. I pledge my allegiance to the Islamic State, and that's why I did what I did."

Investigators believe Archer traveled to Saudi Arabia in 2011 and to Egypt in 2012, the FBI has said. The agency referred further questions to a spokesman for the city's district attorney's office, who did not immediately respond to an emailed request.

Philadelphia Police Department Commissioner Richard Ross, when asked if there's anything else to suggest Archer has links to the extremist group, he said he did not immediately know. He called Archer's statements at the start of the hearing "bizarre."

Archer's attorneys have previously said that the suspect may have mental health problems. He was, however, ruled to be competent enough to stand trial.