At least 15 people, including four foreigners, were killed in a UN office in the Somali capital, Mogadishu on Wednesday.
Witnesses said a battle inside the office lasted for more than an hour.
A cameraman outside the UN Development Programme office told the BBC a suicide bomber blew up a car at its entrance and he saw four gunmen enter.
The al-Shabab group said it was behind the attack.
Police said pro-government forces had since secured the compound.
Two of the dead worked for Denel, the South African state weapons firm.