Somalia parliament attacked by al-Shabab in Mogadishu
The BBC's Mark Doyle: "Al-Shabab can hit almost at will"
Somalia: Failed State
What drives al-Shabab?
Islamist militants from the al-Shabab movement have attacked the Somali parliament in Mogadishu, leaving at least 10 people dead.
Explosions and gunfire were heard and witnesses reported seeing bodies.
Somali police were joined by African Union troops as they engaged the attackers.
Al-Shabab, which is linked to al-Qaeda, once controlled large areas of Somalia but was pushed out of major cities in 2011 and 2012.
However, it is still able to mount complex attacks. It has frequently targeted the UN-backed parliament.
A car bomb exploded outside the gates of parliament shortly before midday local time (09:00 GMT), followed by more blasts and bursts of gunfire.
The attackers then stormed the front of the parliament building as security forces fired back.
"Fighting is going on inside the parliament building and we are fighting rebels inside the building but we evacuated members of parliament," Col Mahamed Dahir said.
At least four police officers and several militants were reported killed. Eyewitnesses saw a number of bodies in military fatigues but could not confirm whether they were members of the security forces.
Two MPs were reportedly wounded in the attack as they were taken out of the back of the building.
Somali soldiers took up positions around the parliament building as MPs were evacuated
Security forces returned fire as the militants attacked the front of the parliament building
African Union troops joined Somali soldiers in trying to repel the attack
"The enemy can now access everywhere," MP Mohamed Nor told Associated Press, criticising the army's failure to protect parliament.
An al-Shabab spokesman told the AFP news agency: "The so-called Somali parliament is a military zone. Our fighters are there to carry out a holy operation."
African Union (AU) troops from the 22,000-strong Amisom security force joined the Somali army in fighting the insurgents around parliament, an Amisom spokesman said.
Analysis by Mark Doyle, BBC World Affairs correspondent
Al-Shabab were pushed out of Mogadishu in 2011 but are still able to mount attacks in the Somali capital
Spectacular attacks on prestige targets attract attention - that's part of their purpose for al-Shabab. But they're just the tip of the iceberg. I've visited Somalia with African Union forces - Amisom - three times in the past year. There were smaller attacks by al-Shabab almost every single day I was there.
The African Union soldiers seek to dismiss these as mere 'harassment' of their garrisons. But these probing attacks - sometimes roadside bombs, sometimes sniper fire - pin the troops down. This is asymmetric warfare and it costs the African Union blood and equipment.
In the past three years Amisom has made significant military advances, pushing al-Shabab out of its fixed positions in Mogadishu and retaking major towns such as Kismayo and Baidoa.
But al-Shabab has the capacity to keep coming back. It is generally accepted in Somalia that if Amisom - with US backing - was not there, the government in Mogadishu would almost certainly fall.
The UN envoy to Somalia Nicholas Kay said he was "horrified" by the attack and paid tribute to the response of Somali and African Union forces.
Somalia has experienced almost constant conflict since its government collapsed in 1991.
With Mogadishu and other towns now under government control, basic services such as street lighting and rubbish collection have now resumed.
Many Somalis have returned from exile, bringing their money and skills with them.
The parliament in Mogadishu - which operated as a transitional assembly from 2004 to 2012 - has been attacked several times, including in 2009 and 2010.
Last month, a Somali parliamentarian was blown up and another shot dead in separate attacks.
In February, al-Shabab militants attacked the presidential palace in Mogadishu, leaving at least 16 people dead.
Al-Shabab, whose name means "The Youth" in Arabic, advocates the strict Saudi-inspired Wahhabi version of Islam.
Are you in the area? Do you have any information to share? Send us your comments. You can email us at firstname.lastname@example.org using the subject line 'Mogadishu'.
Or get in touch using the form below.
Send your pictures and videos to email@example.com or text them to61124 (UK) or +44 7624 800 100 (International). If you have a large file you can upload here.
Read the terms and conditions