On his Twitter account, the UN chief stressed that the perpetrators must be brought to justice.
He also reiterated that the United Nations supports the people of Somalia in the fight against terrorism.
According to local press reports, Wednesday’s attack perpetrated by the Islamist group Al-Shabab on a military base in the Somali capital left at least eight people dead, five of them are foreigners.
The extremist group Al-Shabab, linked to Al Qaeda, claimed responsibility for the attack and said it had fired mortars at the camp where peacekeeping forces from the African Union, the United Nations and other international organizations are stationed.
Insecurity and conflict have persisted in Somalia since 1991, when guerrilla alliances overthrew President Mohamed Siad Barre, who now pits Al-Shabab against federal and semi-autonomous state authority.