Somalia's al-Qaeda-linked al-Shabab rebels have launched a major suicide attack against the heavily-fortified presidential palace, home to the country's internationally-backed government, killing officials and guards before dying in a fierce gunbattle.
A huge car bomb exploded at the perimeter of the central Mogadishu complex, and a group of at least nine suicide attackers breached the Villa Somalia compound, one of the best-defended locations in the war-torn country.
Al-Shabab rebels immediately claimed responsibility.
The country's president, Hassan Sheikh Mohamud, who was unharmed, branded the al-Shabab "a marginal group on the brink of extinction" and vowed Somali and African Union forces would "eliminate" the group.
Security forces fought a fierce gunbattle with the attackers, all young men or teenagers who appeared to be disguised in police uniforms.
Another police official said nine attackers were later found dead and that five Somali soldiers or officials had also died.
A government source said Somalia's former deputy intelligence chief Mohamed Nur Shirbow and Mohamed Abdulle, a close aide to the prime minister, were among the victims.
An al-Shabab spokesman confirmed to AFP by telephone that the group was behind the attack.
"Our commandos have attacked the so-called presidential palace in order to kill or arrest those who who are inside," Sheikh Abdul Aziz Abu Musab said.
The attack came just a week after a suicide car bomb attack at the gates of Mogadishu's heavily-fortified international airport, and the al-Shabab spokesman said the hardline Islamist group wanted to show "that no place is safe for the apostate government".
"The airport, so-called presidential palace and anywhere in Somalia can be attacked as we plan," he said.