Al-Shabab militants shot Abdifatah Barre, the deputy district commissioner of Mogadishu’s Wadajir district, in Mogadishu on Wednesday before bombing an African Union troop convoy outside the capital.
The attacks came during the surprise visit of US Secretary of State, John Kerry.
"Gunmen opened fire on the car of the deputy district commissioner this morning. The official died and the gunmen escaped," Major Ibrahim Hussein, a police officer, told Reuters.
Al-Shabab claimed responsibility for the attacks, Reuters has reported.
"We killed the deputy district commissioner and we shall continue killing the enemies. This is part of our operation in Mogadishu," says Sheikh Abdiasis Abu Musab, the military operations spokesman of al-Shabab.
“On Wednesday, al-Shabab bombed an armored vehicle of African Union (AU) convoy” Colonel Mohamed Abdullahi, a police officer said.
The bomb exploded while the AU convoy was passing through Elasha town, about 16 kilometers (10 miles) Northwest of Mogadishu.
A senior US State Department official had told reporters that they would not turn their backs on the Somali people and they were going to engage with Somalia until they would bring al-Shabab terror to an end, on Tuesday after the visit of John Kerry, the US Secretary of State.