AMISOM stand guard by two bodies
Mohamud was unharmed after two blasts went off outside the hotel where he had been staying in central Mogadishu, but three soldiers were killed in what appeared to be an attack by multiple suicide bombers.
"There has been a blast around the hotel where the president was. The president is safe. All the people who were inside the hotel are safe," Ali Houmed, spokesperson for the African Union mission in Somalia (AMISOM) said.
A police officer said a Ugandan soldier from the regional force and two Somali troops were killed in the attack, adding initial reports suggested it was carried out by three suicide bombers.
An AFP reporter at the scene saw bits of flesh scattered in front of the hotel gates.
Hassan, whose election on Monday was widely welcomed as a boost to the Horn of Africa country's peace prospects, was meeting Kenyan Foreign Minister Sam Ongeri at the time of the explosions, a ministry source in Nairobi said.
The al-Shabab, an al-Qaeda-linked group which has been waging a bloody insurgency against Somalia's Western-backed government for five years, was quick to claim responsibility for the attack.
"We are responsible for the attack against the so-called president and the delegation," al-Shabab spokesperson Ali Mohamud Rage said.
'Nothing personal'
The al-Shabab spokesperson had warned on Tuesday that his group considered as illegtimate the UN-backed process which saw newly-designated lawmakers elect Hassan.
"Nothing personal, but the whole process is like an enemy project," al-Shabab spokesperson had said.
The newly-elected 56-year-old academic's predecessors have all survived numerous assassination attempts in the war-ravaged Somali capital.
AMISOM troops have wrested control of most of Mogadishu back from the al-Shabab in recent months but the insurgent group has continued to attack foreign and government targets, mostly with suicide bombers.
Rage vowed that such attacks would continue "until the liberation of Somalia", where Kenya, Ethiopia, Uganda, Burundi and Djibouti have sent troops to support the government and battle the Islamist insurgency.
Hassan unexpectedly defeated incumbent president Sharif Sheikh Ahmed in Monday's vote in what was interpreted as a sign that Somali leaders wanted to break with the corruption-tainted outgoing administration.
The US state department welcomed the peace activist's election as heralding "new era of Somali governance", while other Western powers also hailed the vote as a major milestone in efforts to restore peace.
Ongoing war
Somalia has not had a credible central authority since the 1991 ouster of former president Siad Barre but Hassan's election came as a semblance of normality returned to Mogadishu and hopes of a recovery grew.
In his acceptance speech, Hassan promised to bring Somalia back into the international fold, but he inherits an ongoing war, a humanitarian crisis, feeble institutions and deeply entrenched warlordism.
Wednesday's attack dampened hopes that al-Shabab would be more inclined to sit down at the negotiating table with the new president than his predecessor.
As a former top leader in the Islamic Courts Union that overran the country in 2006 and gave birth to the al-Shabab group, Sharif was always considered a traitor by Islamist hardliners after taking the top job in 2009. – Sapa-AFP