Mogadishu - Somalia's al- Qaeda-linked militants said they had planned to either assassinate or abduct President Hassan Sheikh Mohamud when they attacked the presidential compound on Friday.
At least 11 people were killed when the Islamist group al-Shabaab blasted through a gate with a car bomb and fought a gunbattle with guards at the heavily-fortified compound known as Villa Somalia.
Mohamud was unharmed in the assault.
"The main objective of attacking the palace on Friday was to assassinate the so-called Somali president or kidnap him," al Shabaab spokesman Sheikh Ali Mohamud Rage told Reuters on Saturday.
"We sent well-trained Mujahideen from our special forces to bring us the president dead or alive."
In the past few weeks, the Somali capital of Mogadishu has been hit by a series of suicide bomb attacks claimed by al Shabaab, who were pushed out of the city in mid-2011 but have continued to wage a sustained guerrilla campaign.
The strike was another reminder of the threat still posed by the rebels and how Somalia's fragile government is struggling to impose order more than two decades after the fall of dictator Mohamed Siad Barre tipped the country into chaos.
Police said the attackers wore uniforms similar to those of the presidential guards, and some wore suicide vests during the well-coordinated attack.
The chief of staff of the office of the prime minister and a former chief of intelligence were killed, along with all nine militants who staged the attack, the government said.
"In 2006, Ethiopian troops came but we chased them and by then we were weak," said Rage. "But now we are strong and determined to fight back and eliminate the Ethiopian troops."
Officials from the presidency were not immediately available to comment on Rage's remarks.
But President Mohamud said on Friday the attack would not stop his government's work to rebuild Somalia and called al Shabaab a "marginal group on the brink of extinction".
Somalia is preparing for a planned military offensive led by an expanded African Union peacekeeping force to drive out the rebels - who want to impose a strict version of Islamic shariah law on the Horn of Africa country - out of their remaining strongholds by the end of 2014.
The offensive could drive al Shabaab fighters into the dense bush of the Lower Shabelle, a region that includes Barawe and lies between the capital Mogadishu and another main port to the south, Kismayu.
Additional troops joining the peace force from Ethiopia are expected to spearhead the offensive. Ethiopian troops have in the past been involved in similar drives against the rebels.