The man, who authorities have identified only as 41-year-old Iraqi, was first spotted threatening pedestrians on a busy street in the district of Spandau, said police spokesman Stefan Redlich.
Once officers arrived, they approached the man and told him to drop his knife, Redlich said. The suspect stabbed one of the officers in her neck and shoulder area, causing severe injuries.
Another officer shot the man, Redlich said. The suspect turned and attacked that officer, who fired several more rounds, killing the alleged attacker.
Redlich told CNN it's too early to say what might have motivated the suspect, who was released from jail in 2013.
The unidentified man was convicted of attempting an attack on Iraqi's prime minister during a visit to Berlin in 2004. Although he had been released, he was ordered to wear an electronic ankle monitor.
"He was under supervision and wears an electronic tag. But he was not under any surveillance," said Berlin prosecutor Michael von Hagen, describing the suspect as someone "belonging to the Islamic scene."
At the time of his arrest in 2004, the man was supportive of the Iraqi insurgent group Ansar al-Islam, many of whose fighters have joined ISIS in recent years, according to Florian Flade, a German terrorism analyst.
Flade identified the suspect as Rafik Y., and suggested a possible connection to terrorism.
"This could very well be related to calls from ISIS -- especially a recent video featuring the Austrian Mohamed Mahmoud calling for attacks in Germany and Austria, saying: 'Take a huge knife and kill a kafir (disbeliever),'" Flade told CNN.
The Berlin prosecutor stopped short of making such a connection.
"This crime was a big surprise for us," von Hagen said. "We cannot say whether it has any Islamic background. Investigations are still ongoing."