Insurgents fired on the Somali president's plane on Thursday and traded mortar and artillery fire with African peacekeepers in the capital Mogadishu, killing at least 21 and wounding dozens.
Mortar shells came crashing down on a busy market area in Mogadishu in one of the worst such incidents in months, shattering a relative lull in the Horn of Africa country's civil war.
"At least 17 civilians were killed and we have counted 58 wounded," Ali Muse, head of the Somali capital's ambulance services, told AFP.
"I can say this was the worst such incident recently in Mogadishu. Heavy shelling was hitting civilian populated areas, including Bakara market, Holwadag and Hodan," he said.
Medics in two different hospitals said a total of four wounded died of their injuries shortly after being brought in, bringing the death toll for the incident to 21.
According to witnesses, the clashes started when insurgent fighters opened mortar fire on the airport as President Sharif Sheikh Ahmed was flying out of the country for a diplomatic visit.
Sharif was heading to Uganda for an African Union summit on refugees and internally-displaced people and boarding the plane when a hail of mortar shells rained down on the area, police officer Colonel Ali Abdullahi said.
"I saw the dead bodies of six civilians killed in one place as they were trying to escape the fire. They died inside a store in Bakara where they had taken shelter," witness Osmail Mohamed told AFP by phone.
"Many people died inside the market. The artillery fire started falling when people were going about their usual daily business. The market was very crowded when the fire started," said Ahmed Abdullahi Gobe, a Bakara trader.
"I have not seen such a tragedy in a long time," he added.
A spokesman for the peacekeepers from the African Union mission in Somalia (AMISOM) said his force had "nothing to do" with the incident but several witnesses were adamant the return fire came from the AU compound.
"The artillery fire that killed the civilians definitely came from the AMISOM bases and it is not the first time they kill innocent civilians while responding to mortar attacks," Sheikh Ali Mohamed Siad Ali-Dhere, chairman of Mogadishu's traders' association, said.
The head of the city's ambulance services also said the deadly retaliatory shelling was fired by AMISOM.
An alliance of the Al Qaeda-inspired Shebab group and the more political Hezb al-Islam group on May 7 launched a countrywide military offensive aimed at toppling Sharif, who has largely owed his survival to AMISOM's protection.
The capital had enjoyed a relative lull in violence since the start of October, notably after the two insurgents groups turned their guns on each other as a deal to share power in the southern port city of Kismayo fell apart.
Sharif was one of the leaders of the opposition to Ethiopia's two-year occupation of Somalia, which ended in January. He eventually joined a UN-sponsored reconciliation process and was elected president.
Opposition hardliners subsequently launched their offensive, claiming that Somalia was still occupied by the 5,000-odd Ugandan and Burundian peacekeepers deployed by the African Union.
The AU force's frequent retaliatory mortar fire has killed dozens of civilians in recent months, seriously denting the contingent's popular standing as well as Sharif's credibility.