A Philadelphia police officer ambushed by a man who claimed allegiance to Islamic State took the witness stand on Thursday to describe being shot through the open window of his cruiser in a chilling attack caught on video.

Officer Jesse Hartnett told a Pennsylvania judge that Edward Archer fired several times through the window of his patrol car but he used his arms to shield his head.

"After he leaves the vehicle, I sit up and assess myself," Hartnett said. "The blood is pooling in my lap at this point."

RELATED:  Muslim organization with rumored link to cop's shooting speaks out

Pennsylvania Common Pleas Court Judge William Austin Meehan found on Thursday that there was enough evidence to hold Archer for trial on charges of attempted murder and aggravated assault in the Jan. 7 shooting. 

Video footage released by police after the shooting showed Archer, dressed in a white gown, running toward Hartnett’s cruiser firing several bullets then sticking the gun inside the window before running away.

Hartnett, 33, described crouching toward the center of the front seat as he shielded his head with his left arm. A bullet pierced his elbow. Unable to use his arm to open the door, Hartnett said he kicked the door open and returned fire, hitting Archer in the buttocks. 

Archer, 30, had no visible reaction to the proceedings, and investigators say he has said little aside from his declaration that he shot the officer in the name of Islamic State.

The extent of his actual connection to the group, which controls parts of Iraq and Syria, and has claimed for responsibility for apparently random attacks in the United States and Europe, remains unclear. 

RELATED:  Philly not in harm's way from ISIS: FBI director

His formal arraignment is set for March 31.

In January, Archer’s mother told the Philadelphia Inquirer he said he had been hearing voices after he suffered concussions playing football. 

A relative told Reuters soon after the shooting that Archer had come back “hardened” in his faith after trips to Saudi Arabia and Egypt.

Around the neighborhood where the shooting occurred, Archer was known as a pious man who organized flag football matches among Muslims.