A suspected Daish militant stabbed two Indonesian police officers on Friday after prayers at a mosque near the national police headquarters in Jakarta, a police spokesman said.

National police spokesman Setyo Wasisto said the incident appeared to be a terrorist attack and the wounded officers had been taken to hospital, while the attacker was shot dead.

"After prayers, the attacker drew out a bayonet while shouting 'infidel'... and then attacked people on his left and right side," said Wasisto.

Police had not yet identified the attacker but Daish sympathisers have carried out a series of mostly low-level attacks in Indonesia since the start of last year.

A gun-and-bomb attack that killed four people in Jakarta last year marked the first Daish strike in the region.

There has since been a string of attacks in Indonesia, the latest of which were twin suicide bombings at a Jakarta bus station that killed three police officers last month and the stabbing to death of a police officer in Medan this week.