Five people, including three police officers, lost their lives on Wednesday near the French Embassy in Dar es Salaam.
This follows a fierce gun battle with an armed individual in an unclear attack.
According to Tanzanian head of police operations, Liberatus Sabas, the lone gunman attacked two police officers, disarmed them and used their guns to shoot sporadically as he advances towards the French Embassy.
The assailant then took cover at a structure adjacent to the embassy where he continued to launch his offensive.
Luckily, the attacker was taken down by a sniper's bullet before he could harm more people.
Tanzanian Inspector General of Police Simon Sirro said the attacker was a foreign national believed to be of Somalian descent.
Sirro intimated the attack could have a jihadist insurgency signature in the neighbouring country of Mozambique.
Currently, there is a surging number of African nations jointly fighting the jihadists.
However, the Tanzanian authorities are yet to establish if the incident was indeed a terrorist attack.
The attack came shortly after Tanzanian President Samia Suluhu had addressed security officials in Dar es Salaam.
After learning about the attack, Samia confirmed the death of the three police officers, one member of the auxiliary police and the attacker.
It also emerged that the U.S. Embassy had warned citizens and advised them to avoid the area.
Apparently, the incident happened just a short distance from the deadly scene of the 1998 U.S. Embassy bombing.