BERLIN -- German police shot and killed a known Islamic extremist after he threatened passers-by and attacked an officer with a knife on the streets of Berlin, officials said Thursday.

Officers were called to Spandau, in western Berlin, after reports that a man was waving a knife about on the street. The 41-year-old man seriously injured a female officer before another officer shot and killed him.

Security officials confirmed to The Associated Press that the attacker was Rafik Mohamad Yousef, who was convicted seven years ago of belonging to an al Qaeda-linked terror group. The officials spoke on condition of anonymity because they weren't authorized to release the man's name publicly.

Frank Henkel, the interior minister for the state of Berlin, said the reasons for the attack were still unclear. "There are indications that this wasn't a planned act," Henkel said in a statement, but added that due to the man's history "a religious motif can't be excluded."

Yousef, an Iraqi national, was arrested in December 2004 after German officials suspected him and two others of being part of a plot by the Ansar al-Islam group to attack former Iraqi Prime Minister Ayad Allawi during a visit to Berlin.

German authorities wanted to deport him to Iraq after his release in 2013 but were unable to do so because he could have faced the death penalty in connection with the attempted assassination, Henkel said.

Yousef was ordered to wear an electronic tag, which he removed on Thursday morning.

Police spokesman Stefan Redlich said the injured officer was in a stable condition in intensive care.