Somalia’s new president, Hassan Sheikh Mohamud, a longtime academic and political activist, boasted during a June interview with McClatchy that he’d lived in Mogadishu – sometimes referred to as the world’s most dangerous city – for 22 years without a security detail. Now that he’s the president, that will have to change.

At least eight people were killed and six wounded Wednesday when at least two explosions rocked a hotel where Mohamud, in office less than 48 hours, was meeting with other African diplomats.

Neither Mohamud nor any of the visiting foreign officials was harmed in the attack, but the attempt put a quick and bloody end to the president’s short honeymoon – he’d been sworn in only Monday evening after defeating incumbent President Sheik Sharif Sheikh Ahmed in a parliamentary vote – and served as a reminder of how difficult it will be for the previously untested new ruler to confront the problems of the world’s most troubled nation.

A spokesman for al Qaida’s Somali affiliate, al Shabab, claimed responsibility for the attack in an interview with the French news agency Agence France-Presse. "We are responsible for the attack against the so-called president and the delegation," Ali Mohamud Rage said. Al Shabab doesn’t recognize Mohamud’s government, saying it’s illegitimate and foreign-backed.

Speaking briefly to reporters after the incident, Mohamud vowed that his government would improve security. "You see what is happening in front of this hotel," he said.

Mohamud was meeting with Kenyan Foreign Minister Sam Ongeri and other officials from the African Union when suicide bombers attacked the Jazeera hotel, where Mohamud is living until arrangements are complete for him to move into the presidential palace. The Jazeera hotel is near the Mogadishu airport, which is the base for the African Union military force, known as AMISOM, that protects the fragile government.

A United Nations statement said three suicide bombers in Somali military uniform had attempted to enter the hotel but that security forces killed them before they got inside. The statement said “a number” of Somali security personnel were wounded in the attack and one AMISOM soldier was killed.

According to eyewitnesses, a man wearing a government military uniform tried to enter the hotel and then blew himself up outside. Gunfire broke out between the attackers and government and African Union troops before a car bomb exploded.

"One of the bombs was a suicide blast, which targeted the gate of the hotel, while the other one was a car suicide bomb that caused several casualties. Troops then opened fire and killed a suspect next to the hotel," said one witness, Dahir Ilmi, who said he saw the bodies of two Somali soldiers and an African Union soldier.

The U.N.’s top official in Somalia, Augustine Mahiga, condemned the attack. “Somalia has achieved tremendous progress over the last few months,” he said. “Such attempts to push the country back into chaos and violence will not deter the Somali people’s determination to move forward."