"The officer fired back in self-defense and managed to kill (the attacker). My officer is in hospital in a stable condition. The victim died on the spot," Vitalis Otieno, the Gigiri division commanding officer of the Nairobi Police, told CNN.
The man killed was a Kenyan national, police said, but they are not releasing his name while the case is under investigation. His motive was not immediately clear.
The officer was stabbed in the head, Otieno said. Further details about the officer's injury weren't immediately available.