The gunman who killed four people in Tanzania's financial capital Dar es Salaam last week before being shot dead was "a terrorist" who was radicalised by social media, police said Thursday.
The gunman -- identified by police as Hamza Mohamed -- went on a rampage on August 25, killing three officers and a private security guard in the city's diplomatic quarter, in a rare attack in the East African nation.
"Our investigations have revealed that Hamza Mohamed was a person who had a secret life with all indicators of terrorism," the director of criminal investigations Camillus Wambura told journalists, describing him as a "terrorist".
"He spent much of his time to learn about the kinds of terrorism incidents such as those conducted by Al-Shabaab and ISIS through the internet, like many terrorists do," Wambura added.
In addition to the four dead, six other people were injured in the shooting spree, which took place near the entrance of the French embassy.
Footage aired on local media showed a man in a checked shirt and white Islamic cap armed with an assault rifle roaming the street near a city bus.
Dozens of police officers, politicians and Tanzanian citizens gathered on Friday at a ceremony to pay their last respects to the slain officers.
Neighbours have expressed shock at the shooting, saying the attacker lived with his mother in a flat about two kilometres from where the incident took place.
"I knew him since he was a young boy. There was a time he disappeared until he came back recently," taxi driver Omary Issa said.
"He was an ordinary person whom we interacted like any other neighbour. I was really shocked," he added.
Such attacks are rare in Tanzania, which has been largely peaceful in contrast to its volatile neighbours such as Mozambique.