Four of the men involved in the attack on the Riau Police headquarters in Pekanbaru on Wednesday had previously tried to help terror detainees who were rioting at the Mobile Brigade headquarters (Mako Brimob) last week, police said.
One of the dead men had a suspected bomb strapped to his body, the report said. The fifth suspect who fled was was later arrested, he added.
TV footage showed one man lying on the ground with a long sword next to his body and an armoured vehicle stationed outside the police station.
The "Islamic State" (IS) group, which is supported by as many as 30 Indonesian militant groups, quickly claimed responsibility for Wednesday's assault through its Amaq news agency.
Police spokesman Muhammad Iqbal said the militants fired rampant shots at the police building located on Sudirman street in Pekanbaru, the Riau provincial capital at 9 am Jakarta time (0200 GMT).
Police blame a local IS-inspired group, Jemaah Ansharut Daulah (JAD), for the attacks in the city of Surabaya.
Kerch Bridge is another violation of Ukraine's sovereignty
The bridge was completed six months ahead of schedule, according to Russian state news agencies. The opening of the bridge comes a day before general traffic will be allowed.
"Three officers were injured and one later died in hospital", said local police chief Nandang, who goes by one name.
Media were at the station to cover a press conference about a drug bust when the attack happened.
The church bombing family - whose father was named a local JAD leader - and two other families linked to this week's attacks knew each other and were part of the same Koran study group, police said.
The attacks are the worst in the world's biggest Muslim-majority country since the bombing of tourist-packed restaurants in Bali in 2005.
Following the 2002 Bali bombings, it had been widely praised for its sustained anti-terrorism crackdown.
A suicide bombing was also reported at the city's police headquarters on Monday when bike-borne attackers blew themselves up at the checkpoint to the precinct.