Al Shabaab militants stormed Somalia's parliament on Saturday, killing at least 10 security officers in a bomb and gun assault that the United States condemned as a "heinous act of terrorism."
The attack started with a car bomb at a gate to the heavily fortified parliament compound, followed by a suicide bombing and then a gun battle that continued for hours. Al Shabaab is an al Qaeda-linked group that killed 67 people at a Kenyan shopping mall last year.
"Ten government forces died and 14 others were injured in the attack today. Four lawmakers were also injured. Seven of the fighters who attacked the house were also killed as you see their bodies," Kasim Ahmed Roble, a police spokesman, told reporters at the scene.
Roble made no mention of any civilian casualties.
A spokesman for al Shabaab, Sheikh Abdiasis Abu Musab, said the group's fighters had killed 30 people. "We killed 30 from the AU (African Union) and from the various forces of the so-called Somali government," he said.
The al Shabaab estimate of the death toll was not independently verifiable.
Reuters witnesses saw four bodies at the scene and a soldier fall from a rooftop after being shot. Reuters television pictures showed a large pool of blood near a blast site, and a man with his shirt drenched in blood running away from the scene.
Building near president's palace
The fighting continued for hours after the initial explosion, with gunfire and smaller blasts being heard around the parliament.
"We are behind the suicide bombing, explosions and the fighting inside the so-called Somali parliament house, and still heavy fighting is going on inside," said the al Shabaab spokesman.
The African Union Mission in Somalia said in a statement that all the lawmakers who were in parliament before the attack were safely evacuated.
The attack on parliament, a building about 300 metres from the president's palace that is guarded by African Union peacekeepers and Somali forces, showed that the al Qaeda-linked group remained capable of hitting the centre of Mogadishu despite being pushed out of the capital two years ago.
"The terrorists have once again shown that they are against all Somalis, by killing our innocent brothers and sisters. These cowardly, despicable actions are not a demonstration of the true Islamic faith," said Prime Minister Abdiweli Sheikh Ahmed.
The U.S. State Department strongly condemned the attack, offering condolences "to those affected by this heinous act of terrorism."
"We continue to stand firmly with the Federal Government of Somalia and the many international partners working to support its efforts to root out the threat posed by al-Shabaab," State Department deputy spokeswoman Marie Harf said in a statement. "Cowardly acts such as these will not shake our resolve."
Nicholas Kay, the UN secretary-general's special representative for Somalia, said: "The Federal Parliament represents the people of Somalia and their hopes and aspirations for a peaceful and stable future. Today's attack is an attack against the people of Somalia for which there can be no justification."
Somalia's government is struggling to impose any sense of order, more than two decades after the fall of dictator Mohamed Siad Barre tipped the country into chaos.
In February, at least 11 people were killed when al Shabaab attacked the presidential compound. In April, it killed two lawmakers.
After the blast, Somalia's security minister said on state radio he was resigning, while the president said on the same radio he was cutting short his trip to South Africa, where he had gone to attend President Jacob Zuma's inauguration.
A Western diplomat who has worked with regional intelligence agencies said the attack would add to pressure on President Hassan Sheikh Mohamud from about 100 parliamentarians who last month called for him to be impeached over worsening security.
"The federal government is exercising no control," the diplomat said. "Those ... in parliament will start asking questions: What is this guy achieving?"
The diplomat said the attack showed that a surge by the African Union peacekeeping troops had not weakened al Shabaab's capacity to wage asymmetric warfare in the capital, where coordination between Somali and foreign intelligence agencies is poor.
"Because intelligence is fragmented, al Shabaab is slipping through the net," said the diplomat. "They are becoming more dangerous."
In neighbouring Djibouti, at least two people were killed on Saturday in double grenade blasts at a busy restaurant popular with Westerners in Djibouti, police said.