He said police investigating the case had discovered that two of the attacker's brothers were police officers in Tangerang
Indonesian police shot dead a man carrying knives, suspected pipe bombs and a symbol of the Islamic State group after he launched a daylight assault on officers near Jakarta on Thursday, an official said.
The man was shot three times as he stabbed wildly at officers on a busy intersection in Tangerang, a satellite city outside the capital, Jakarta police spokesman Awi Setiyono told AFP.
Setiyono said the perpetrator threw two suspected pipe bombs at the officers, but neither detonated, and displayed an IS symbol on a nearby traffic pole during the frenzied attack.
"A man suddenly stuck an IS logo sticker on a traffic police post, took a machete from his bag and blindly attacked our personnel," he said.
The attacker -- believed to be a member of a local hardline group -- was also carrying a turban, along with knives and the suspected bombs, Setiyono added.
The 21-year-old attacker later died from his wounds, the spokesman said.
He said police investigating the case had discovered that two of the attacker's brothers were police officers in Tangerang.
Three officers were injured and taken to hospital.
Police have often been the target of attacks by extremists in Indonesia, a country that has long struggled with Islamic militancy.
In January, police officers were targeted by gunmen and suicide bombers at a traffic post in central Jakarta. The IS-claimed attack left four civilians and four militants dead, and injured several police officers.
Police and military personnel have also been killed in clashes with extremists in a remote part of Sulawesi, where for years a ragtag militant group has been waging a conflict against security forces from their jungle hideout.
Indonesia suffered significant attacks in the 2000s including the 2002 Bali bombings that killed more than 200 people, mostly foreign tourists.
A sustained crackdown weakened the most dangerous networks but IS has proved a potent new rallying cry for Indonesia's radicals, stoking fears that militants fighting with the group could seek to organise attacks back home.