A police officer ambushed by a silent gunman who later said he acted in the name of Islam testified in court Thursday about the attack, detailing how he kicked his way out of the cruiser to return fire.

Philadelphia prosecutors have found no evidence that suspect Edward Archer has any links to terrorism, though federal authorities continue to explore that issue. Archer's lawyer said he may instead have mental health problems.

Archer, 30, was held for trial on attempted murder and other charges after Thursday's preliminary hearing. He used a stolen police weapon in the attack and emptied the chamber, authorities said.

Officer Jesse Hartnett testified about how his left arm was shattered by gunfire as he used it to cover his head in the vehicle. He said he later kicked the door open to pursue Archer, shooting him three times, before he went to the trunk of his cruiser to look for a tourniquet. Help soon arrived, and two other officers apprehended Archer a block away. They found the gun wrapped in the long white cloak he had been wearing.

Hartnett, 33, spent two weeks in the hospital after the January attack. He has endured seven surgeries and has an eighth scheduled.

"The fact that he had his wits about him, to think, `I need to go back to my patrol vehicle; I need to get a tourniquet,' I can't imagine anyone doing that," Assistant District Attorney Allison Borgatti said after the hearing.

Police Commissioner Richard Ross and other officers filled the courtroom to support Hartnett during his testimony.

Archer told detectives after his arrest that he believed police enforce laws that undermine the Quran's teachings, officials have said.

"I follow Allah. I pledge my allegiance to the Islamic State, and that's why I did what I did," Homicide Capt. James Clark has quoted him as saying.

Investigators believe Archer traveled to Saudi Arabia in 2011 and to Egypt in 2012, FBI special agent Eric Ruona said previously. The FBI this week declined to comment further on their ongoing investigation.

The weapon, a 9 mm Glock pistol, had been stolen from a Philadelphia police officer's home in 2013, police officials have said. It's not clear how it made its way to Archer, who was also charged with receiving stolen property.

He is due back in court March 31 for an arraignment.