There was a shootout near the French embassy in the Tanzanian city of Dar es Salaam on Wednesday.
The suspected shooter was neutralised by a sniper.
The motive of the attack is still not clear and authorities are yet to comment.
The shooting occurred as President Samia Suluhu met police chiefs at a different location in Dar es Salaam.
The US embassy in Tanzania has issued an advisory urging its citizens to avoid the area near the French embassy and monitor local media for information.