A gunman killed three police officers and a private security guard on a rampage through a diplomatic quarter of Tanzania's main city Dar es Salaam on Wednesday, before being shot dead while holed up in a guardhouse at the French embassy's gate.

Iran PressAfrica: According to African news, Tanzania's president on Wednesday said five people are dead, including three police officers, after a gun battle with an armed man near the French Embassy in  Dar es Salaam.

It was not immediately clear whether the shootout in the heavily guarded diplomatic area was a terror attack.

Liberatus Sabas, Tanzania's head of police operations, said the gunman attacked two police officers, took their guns and then "began shooting sporadically towards the French Embassy."

"He then took cover at a structure next to the French Embassy where he continued shooting," Sabas said.

Inspector general of police Simon Sirro told reporters the armed man was a foreigner and police believe he was from Somalia.

The confrontation occurred shortly after President Samia Suluhu Hassan addressed security officials in another part of the city, Tanzania's commercial hub.

The president later said three police officers, a member of the auxiliary police and the armed man were killed, and she ordered an investigation.

The U.S. Embassy in a security alert warned citizens to avoid the area.

The shootout occurred not far from the scene of the deadly bombing in 1998 at the U.S. Embassy. 219