New York (AFP) – A man who claimed allegiance to the Islamic State group when he shot a Philadelphia police officer in 2016 was sentenced Monday to a minimum 48 and a half years in prison.

Edward Archer, 33, ambushed Jesse Hartnett on January 7, 2016 while the police officer was patrolling in his car. Archer fired a dozen times with a pistol, hitting Hartnett three times and breaking bones in his arm.

The attack stoked worries at the time of a surge in “lone wolf” terror attacks by extremists inspired, but not directed, by the Islamic State or Al-Qaeda.

Archer was caught on video wearing a long white robe and firing as he ran up to the police cruiser and pushed the gun through the car window, continuing to shoot, before finally running away.

Hartnett, despite his wounds, managed to get out of the car and fire back, hitting Archer in the buttocks. 

Archer later told police he was inspired by Islamic State. 

But while he was found to have traveled to Saudi Arabia and Egypt years earlier, officials did not connect him directly to any jihadist group, and he was not charged with any terror-related offense.

Archer was found guilty of attempted murder on February 1 after a two-week trial.

He was given the maximum sentence — a range of 48 and a half to 97 years in prison.

Hartnett, who still struggles with his wounds after 11 operations, said he was “absolutely glad” about the sentence, according to ABC television.

“I obviously would want the maximum penalty and he did receive the maximum penalty. I wish he had more,” he said.

“As long as he doesn’t get out of jail, I’ll be happy.”