The two police officers were stabbed in the neck and face and are being treated at a local hospital.
Jakarta: Indonesian police shot dead a suspected militant after he stabbed two policemen inside a mosque near the national police headquarters in Jakarta, less than a week after an Islamist attack on security forces.
The attacker had just finished praying with several policemen and other worshippers Friday night when he stabbed the two officers and screamed 'infidel', said national police spokesman Rikwanto, who like many Indonesians goes by one name.
The perpetrator immediately ran to a nearby crowded bus terminal and refused to surrender. "He instead threatened to attack (us) with a bayonet. After warning shots were fired, he was killed on the spot," Rikwanto said.
The two police officers were stabbed in the neck and face and are being treated at a local hospital. The motive and identity of the attacker are still being examined, police spokesman Setyo Wasisto said.
Indonesia has seen a string of low level attacks since January last year carried out by Islamic State sympathisers mostly targeting the police.
The attack is just the second attack on the police this week. Last Sunday, two alleged Islamic State group militants attacked the police headquarters in North Sumatra province leaving a policeman dead.
In May three police officers were killed in twin suicide bombings at a Jakarta bus station.