Police have killed a known Islamic extremist from Iraq, who was waving a knife in a Berlin street. He attacked a female officer, according to German prosecutors.

The man, who had a criminal record, was shot and killed by German police in Berlin on Thursday, AP reports. He was waving a knife on a street in Spandau. When the police arrived at the scene, he managed to seriously injure a female officer.

The incident happened at about 10 a.m. local time in western Berlin, when four police cars arrived at the scene where passers-by reported an “insane man with a knife.”

The female officer, 44, sustained a wound in the neck. She was rushed to a military hospital on a rescue helicopter, and is now recovering after surgery, Bild reported.

The attacker was of Iraqi origin, Al-Qaeda affiliated, 41-year-old Rafik Y., according to the Bild newspaper.

“As far as we know, the person killed was an Iraqi citizen, who was convicted to eight years behind bars in 2008 for being a member of a foreign terrorist organization,” Chief Prosecutor Dirk Feuerberg said at a press conference, as cited by Bild.

Prosecution spokesman Martin Steltner told AFP that the man got a jail term for his participation in a murder plot against former Iraqi Prime Minister Iyad Allawi, alongside two other members of Iraqi militant group Ansar al-Islam, which is affiliated with Al-Qaeda.

German authorities foiled the assassination a few days before Allawi's arrival in Berlin on a 2004 trip. However, so little was known about the initial plan that the trial didn’t until June 2006.

The 2008 court hearing took place in Stuttgart, according to the dpa news agency.

In 2013, the assailant was freed on bail, but was sentenced to wearing an electronic tag for monitoring. He reportedly removed it from his ankle before the attack.