A car bomb at a marketplace in Somalia's capital Mogadishu has killed at least 34 people and injured 52 others, a police officer has said.

Many of the dead were carried away by their relatives soon after the blast, Captain Mohamed Hussein said.

"It was a horrific and barbaric attack only aimed at killings civilians," he said from the scene of the blast.

Loading

Ambulance driver Sabriye Abdullahi said some of the injured victims died on their way to hospital.

"Many of them suffered extensive third-degree burns and others were burned beyond recognition," he said.

The blast by a car bomb parked near a restaurant went off at a busy time when shoppers and traders were gathered inside the market, district commissioner Ahmed Abdulle said.

Mohamed Haji, a butcher who suffered shrapnel wounds, pointed to a clothes shop devastated by the blast.

"Someone had parked the car here and left before it was detonated," he said.

Pieces of wood and metal sheets on the ground were all that remained of the shop.

Women sobbed and screamed outside the market as rescue workers moved bloodied bodies and wounded victims into ambulances.

"It's a painful carnage," said government soldier Ali Mire, who was helping a friend with shrapnel wounds.

The powerful explosion was the first major attack since Somalia's new president, Mohamed Abdullahi Farmajo, was elected on February 8.

Although no group has yet claimed responsibility, it bears the hallmarks of Somalia's Islamic extremists rebels, al-Shabaab.

In a Twitter post, President Mohamed Abdullahi Mohamed condemned the blast, saying that it shows the "cruelty" of al-Shabab.

A few hours before the blast, al-Shabaab denounced the new president as an "apostate" and vowed to continue fighting against his government.

The extremist group claimed responsibility for a mortar attack outside the presidential palace on February 16 during a handover ceremony for the new president.

Italian Foreign Minister Angelino Alfano, in a statement condemning the attack, said that "Italy remains solidly on Somalia's side in the process of the country's stabilisation."

He added that "together we will act so that the terrorists don't succeed in stopping the path of peace and reconciliation that is underway".

AP