A huge blast tore through buildings near the mayor's office in central Mogadishu on Sunday, with gunfire erupting afterwards, police and witnesses told AFP.
"Terrorists blasted a vehicle loaded with explosives onto a perimeter wall of the Mogadishu mall which is next to the Banadir administration headquarters," police officer Abdullahi Mohamed said.
Witnesses said the explosion damaged nearby buildings and gunfire could still be heard near the mayor's office.
"There is gunfire going on inside the vicinity of the main building but we don't know what is happening inside," a witness who runs a business near the offices said.
"There are some casualties but the whole area is cordoned off and we have been asked to move away by the security forces."
Another witness, Omar Nur, said he was inside the mall when the explosion went off and "was lucky to have escaped safely."
It was not immediately clear who was behind the attack.
Militants have been waging a bloody insurgency against the frail internationally backed central government for 15 years, carrying out attacks both in Somalia and neighbouring countries.
The latest attack comes days after seven soldiers were killed on Friday by the Al-Qaeda-allied Al-Shabaab group in a military camp in Galcad, a town in central Somalia about 375 kilometres (230 miles) north of the capital Mogadishu.
The US military said on Saturday the attack involved more than 100 Al-Shabaab jihadists.
"The combined actions by partner forces on the ground and the collective self-defense strike is estimated to have resulted in three destroyed vehicles and approximately thirty al-Shabaab terrorists killed" the US military command for Africa (AFRICOM) said in a statement.
In recent months, the Somali army and local clan militias have mounted a major offensive against the jihadist group, retaking swathes of territory in the centre of the country in an operation backed by US air strikes and an African Union force.
But despite the gains by the pro-government forces, the militants have continued to demonstrate the ability to strike back with lethal force against civilian and military targets.
On Tuesday, Al-Shabaab launched a deadly attack on a military base in another part of central Somalia, just a day after the government claimed a "historic victory" over the jihadists.
Although forced out of Mogadishu and other main urban centres more than a decade ago, Al-Shabaab remains entrenched in parts of rural central and southern Somalia.
In the deadliest Al-Shabaab attack since the offensive was launched last year, 121 people were killed in two car bomb explosions at the education ministry in Mogadishu in October.
The group has also been active recently across the border in eastern Kenya, which is a contributor to the African Union force in Somalia, carrying out several deadly small-scale attacks.
Eleven soldiers including a senior commander were killed Tuesday in an attack on an army camp north of Mogadishu.