"We urge Somalis to defend against those groups that include foreigners, and we ask the international community to back us," Ahmed said at a news conference at his Villa Somalia residence.
Al-Shabab, in alliance with the Hizbul Islam group, has vowed to overthrow Ahmed, accusing him of being a traitor after he signed a peace deal with the interim government last year.
Ahmed was previously a leader of the Islamic Courts Union, which effectively controlled much of southern and central Somalia in late 2006, and counted al-Shabab and other groups fighting the government as its allies.
"I can tell you that 80 per cent of the people killed and injured are civilians who were caught in the crossfire"
Mohamoud Ibrahim Garweyne, Somalia's humanitarian affairs minister
The United States says that al-Shabab is linked to al-Qaeda, while Hizbul Islam is led by Sheikh Hassan Dahir Aweys, another former Islamic courts leader, that Washington says has connections to al-Qaeda.
Security officials say that the groups have become more sophisticated in recent months, planting improved roadside devices and carrying out suicide attacks.
Al-Shabab has warned that there will be more suicide attacks against government forces in the coming days after a surge in violence this month killed almost 200 people in the capital, Mogadishu.
"I can tell you that 80 per cent of the people killed and injured are civilians who were caught in the crossfire," Mohamoud Ibrahim Garweyne, Somalia's humanitarian affairs minister, said on Monday.
"The clashes have also displaced 8,367 families, who have reached temporary camps outside the capital where their livelihoods are very precarious."
The UN says that about 60,000 residents fled their homes in the capital in recent days, joining more than one million people who had already been displaced by the fighting.
"It's almost impossible for us, or even our Somalis partner organisations, to reach these people, who are likely to go without food and shelter for a long time," Roberta Russo, a spokeswoman for the UN refugee agency, said in Nairobi.
Separately, the Reuters news agency reported that a Somali religious leader, said to have criticised al-Shabab's activities, was kidnapped from a Kenyan refugee camp on Monday.
Abdikadir Abdi was seized while sleeping outside his makeshift shelter at Ifo camp in north-eastern Kenya and was bundled into a vehicle that sped toward the Somalia border, the news agency reported.