Violence has escalated over the past month, with Sunday's gun battle in Mogadishu claiming up to eight lives [AFP]

Clashes between soldiers from Somalia's UN-backed government and al-Shabab fighters in the capital Mogadishu have killed at least eight people and injured 18 more, according to a medical official.

Sunday's deadly gun battle erupted less than 24 hours after heavy shelling at Mogadishu's Bakara market  killed at least seven people.

"The insurgents attacked our position but they failed to capture it. Instead we captured from them several strategic positions," Sheikh Abdirasaq Qaylow, an official from the Somali information ministry, said, referring to the latest clashes.

Somalia has experienced an escalation in fighting over the past month, with al-Shabab, an anti-government group accused by US officials of having links to al-Qaeda, trying to overun the weak government of Sharif Sheikh Ahmed.

The weekend violence coincides with the Somali president's return to Mogadishu from New York, where he participated in the UN General Assembly last week.

Somalia has not had a fully functioning government in almost 20 years.

Sharif's government controls only a few parts of the country, with al-Shabab and other armed opposition groups controlling most of the southern and central parts.

Al-Shabab seeks to impose its version of Islamic law on the rest of the country.

Somalia has been racked by violence for more than two decades, and hundreds of thousands of people have fled their homes, creating one of the world's worst humanitarian crisis.

Source: Al Jazeera and Agencies