Suicide blast by offices of Somalia president and PM
Two security guards have been killed in a suicide attack near the offices of Somalia's president and prime minister.
Three other guards were also wounded when the assailant blew himself up at a checkpoint near the compound housing the offices in the capital, Mogadishu.
The bomber was an ex-Islamist militant recently sacked from his job in the intelligence services, officials said.
Militants aligned to al-Qaeda have lost control of major towns in the last 18 months but still carry out attacks.
The president and prime minister took office following elections last September which were considered the first fair polls in Somalia for 42 years.
Hassan Sheikh Mohamud, an academic and civic activist, beat the incumbent in a run-off vote by MPs to become president.
He then appointed his close associate, former businessman Abdi Farah Shirdon, as prime minister.
The attacker detonated his explosives when he was questioned at a checkpoint into Villa Somalia, a sprawling compound that houses both the president's and prime minister's offices, officials said.
Information Minister Abdullahi Hersi said the bomber, a former member of the Islamist militant group al-Shabab, had been an employee of the intelligence services until recently.
The African Union (AU) mission in Somalia - which has 18,000 troops in the country supporting and training government troops - said the bomber blew himself up as he was chased away from the checkpoint.
"The heroic actions of the dead soldier and his compatriots have saved many Somali lives," said Mohamat Annadif, the AU's special representative on Somalia, said in a statement.
Correspondents say it is not clear if Prime Minister Shirdon was in the compound at the time. President Mohamud was not in the country.
Their new government is trying to rebuild Somalia after more than 20 years of conflict -
One of its biggest challenges is how to deal with al-Shabab, which has joined al-Qaeda and still controls large areas of southern and central Somalia.
The BBC's Abdullahi Abdi, reporting from Kenya, says that the number of suicide attacks in Mogadishu has decreased since the withdrawal of al-Shabab from the capital in August 2011.
But the latest attack shows that the militants still pose a threat to the city's security, he adds.
Meanwhile, the United Nations World Food Programme has announced that it has resumed distribution of food aid in the southern port city of Kismayo for the first time in four years.
The WFP and other international aid organisations have not been allowed to work in areas controlled by al-Shabab.
Feeding centres providing hot meals for 15,000 people have been set up in Kismayo, which AU and government forces recaptured last September.
A recent survey showed high levels of malnutrition and food insecurity in the city, the WFP said.
"The survey showed that almost half the households in Kismayo are really struggling to meet their daily needs, and 24% of children below the age of five are malnourished," Stefano Porretti, WFP's representative in Somalia, said in a statement.
Years of fighting between rival clan-based warlords as well as Islamist militants has led to an inability in the drought-prone country to deal with hunger and disease.