The attack comes six months after UN expanded its presence in the country.
Two South Africans were among the victims.
More than half a dozen al-Qaeda-linked militants stormed a United Nations house in Somalia’s capital, Mogadishu, on Wednesday triggering a clash with security forces that left at least 10 people dead.
Reports say at least seven gunmen detonated a pick-up truck rigged with explosives at the gate of the U.N. compound and followed up with intense gunfire that saw at least nine people, including three foreigners killed.
African Union and Somali security forces responded and took control of the compound by 12:30 p.m., the Associated Press reported, and all the gunmen were killed bringing the overall death toll to at least 16.
Interior Minister, Abdikarim Hussein Guled, said four foreign U.N. security staff and four local guards were killed in the attack.
The AP quoted a spokesman for the United Nations Assistance Mission in Somalia, Ben Parker, as saying that the U.N. staff who sought refuge in the compound’s secure bunker were then evacuated to the secure military base and airport complex across the street.
Two South Africans from the company Denel Mechem who were doing work for the U.N. died in the attack, said Vuyelwa Qinga, a spokeswoman for Denel, a manufacturer of defense equipment.
Somalia’s most feared Islamist group, Al Shabaab, claimed responsibility for the attack. The group said on its Twitter feed shortly after the attack assault began that its fighters “are now in control of the entire compound and the battle is still ongoing.”
The attack was the first on U.N. premises by al Shabaab since the group was driven out of Mogadishu in fighting with AU and Somali government forces about two years ago.
It also came six months after the U.N. expanded its presence in the capital, from where it had withdrawn most of its officials due to insecurity years back.
The top U.N. official in Somalia, Nicholas Kay, was quoted by Reuters as saying that there were lessons to be learned but that the United Nations would not be deterred from its mission.
The overthrow of a dictator in 1991 plunged Somalia into two decades of violent turmoil, first at the hands of clan warlords and then Islamist militants, who have steadily lost ground since 2011 under pressure from the AU military offensive.