Al Qaeda-linked militants attacked the Somali presidential compound in Mogadishu on Tuesday, forcing their way inside, but President Hassan Sheik Mohamud was not there at the time.
The Shabab fighters detonated a car bomb near the entrance to the compound and gunmen then moved inside, security officials told news agencies. The car bomb was believed to be a suicide attack.
Mohamud was away, meeting with the United Nations' special envoy to Somalia, Nicholas Kay. Later, the president appeared on TV, saying he wasn't frightened, nor had he fled.
It was the second attack on the compound, known as Villa Somalia, this year. In this case, the militants managed to get inside the compound, which houses a number of government offices, including the residence of the president.
“We have entered the so-called presidential palace. We have now captured some parts of the palace and fighting is still going on," Sheik Abdiasis Abu Musab, a spokesman for the Shabab, told Reuters news agency.
He claimed 14 government soldiers were killed.
Security officials claimed all the gunmen were killed in fighting with security forces at the heavily guarded compound. Interior Minister Abdullahi Godah Barre told Reuters that five attackers were killed while other officials said at least nine gunmen died in the fighting.
A police official told the Associated Press that the prime minister and parliament speaker were both in the compound when the attack happened. Both were unharmed.
The Shabab recently announced that it would step up attacks during the Muslim holy month of Ramadan. The attack came days after a suicide bomber struck near the parliament, killing at least four people.
The Shabab has lost territory to African Union forces known as AMISOM in recent years but still controls large swaths of the countryside and often carries out bomb attacks and assassinations in the capital, Mogadishu, and other major cities.
The militia abandoned Mogadishu in 2011, instead opting for a guerrilla-style campaign.
Attackers of the presidential compound in February employed similar tactics: a car bomb exploded near the perimeter, followed by gunmen attacking on foot.
The Shabab has claimed responsibility for several recent attacks in Kenya, including assaults on villages on the eastern coast near the tourist town of Lamu. Kenyan President Uhuru Kenyatta blamed local political networks for the attacks.
The Shabab was also responsible for an attack on an upscale shopping mall in Nairobi last year in which at least 67 people died.
For more news from Africa, follow @latimesdixon on Twitter