A day after the election of Somalia's new president, two explosions at the gate of his temporary residence killed at least five people and wounded three others Wednesday, witnesses and officials said.

The blasts took place as Somali President Hassan Sheikh Mohamud was holding a press conference in the building, the Jazeera Hotel, with visiting Kenyan Foreign Minister Sam Ongeri.

Al-Shabab, a radical Islamist militia that is affiliated with al-Qaida and which is waging an insurgency against the Somali government, quickly claimed responsibility for the attack. Al-Shabab had opposed Mohamud's election, saying it had been manipulated by western powers.

At least five people were killed in the blast, according to witness Mohammed Nuradin. An African Union soldier was among those killed in the blast and 3 others were wounded in the incident, said African Union force spokesman Col. Ali Aden.

African Union forces are helping the Somalia government fight al-Shabab, which the U.S. has designated as terrorist group, and which neighboring African countries consider a threat.

Police corporal Yusuf Ali said that he was guarding the Somalia immigration department near the Jazeera hotel when two blasts occurred.

An Associated Press photographer inside Jazeera Hotel for the president's press conference with the Kenyan minister said the two were safe. He said he saw at least five bodies near the gate of the hotel.

Mohamud was elected Monday, beating Sheik Shariff Sheikh Ahmed who was seeking re-election after leading a transitional government for three years. Mohamud is expected to form a fully functioning government for Somalia which has not had one since 1991 when a longtime dictator was overthrown.

Mohamud has taken up temporary residence at Jazeera Hotel in a highly protected zone near the airport before moving in to the presidential palace.

Al-Shabab militants, though evicted from Mogadishu, still penetrate the seaside capital to carry out suicide attacks. One such attack took place last month as Somali elders voted in a new internationally backed constitution that guarantees more rights for women and children. The bombers were stopped at the gates and no one except the two attackers was killed.