Al-Shabaab militants stormed Somalia's parliament today, killing at least ten security officers in a bomb and gun assault that the United Nations called "an attack against the people".

The attack - by the al Qaeda-linked group that killed 67 people at a Kenyan shopping mall last year - started with a car bomb at a gate to the heavily fortified parliament compound.

The car bomb was followed by a suicide bombing and then a gun battle which continued for hours.

A police spokesman said 14 other security officers and four politicians were injured and seven al-Shabaab fighters were killed.

The African Union Mission in Somalia said in a statement that all the politicians 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 remains capable of hitting the centre of Mogadishu despite being pushed out of the capital two years ago.

The US government has condemned the attack.

"The United States strongly condemns today's Al-Shebab attack on the Somali parliament," said the US State Department's deputy spokeswoman Marie Harf.

"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-Shebab, and to build a more secure and prosperous future for the Somali people," Ms Harf said in a statement.

"Cowardly acts such as these will not shake our resolve."

Ms Harf said US officials "extend our sympathies and condolences to those affected by this heinous act of terrorism, and commend Somali and African Union forces for their swift and courageous response."