An insurgent group that appears set to seize control of Somalia said on Wednesday it will not stop fighting until Islamic law governs the country.

somalis-cp-6028753

Somalis help the injured after mortar shells fired by the al-Shabab insurgent group at government and Ethiopian bases landed in the Bakara market in Mogadishu Tuesday. ((Farah Abdi Warsameh/Associated Press))

The vow to continue fighting came from the leader of al-Shabab on Wednesday as thousands of troops from neighbouring Ethiopia prepared to leave the country after two years propping up the government, and days after the Somali president resigned.

"We will not stop fighting even if the Ethiopian troops withdraw because our aim is to implement Islamic law across Somalia," said Sheik Muktar Robow, whose group is considered the most aggressive of the Islamic insurgency groups fighting in Somalia.

Al-Shabab, which the U.S. accuses of having links to al-Qaeda, already controls most of the country after making major territorial gains over recent months.

Nine civilians were killed and 15 others injured in the capital Mogadishu Tuesday after al-Shabab fired mortar shells at government and Ethiopian bases.

Ethiopian troops were expected to leave by the end of December, but not all at once in order to avoid creating a power vacuum. It was not immediately clear when they would actually depart.

Somali Foreign Ministry spokesman Wahide Belay said Tuesday Ethiopian troops would leave the country within days. Somali military officials and soldiers said the Ethiopians are waiting for the word on when to go.

"They have stopped dealing with us, all they could tell us was that they were getting ready for a final departure from Somalia," Somali soldier Fuad Muhumed Afey said of the Ethiopian troops.

President Abdullahi Yusuf announced his resignation to parliament on Monday, saying that the country had lost control to the Islamic insurgents and he could no longer fulfil his duties.

Yusuf's four-year-old administration had appealed to Ethiopia for help in subduing the Islamic insurgency, but ultimately was only able to bring some control to Baidoa, the seat of parliament, and pockets of the capital, Mogadishu.

Somalia has been plagued by violence and anarchy since warlords overthrew dictator Mohamed Siad Barre in 1991 and then turned on one another. The current government was formed as a transitional administration with UN help in 2004.

Human rights groups have accused all sides in the conflict — Islamic insurgents, the government and Ethiopian troops — of committing war crimes and other serious abuses for indiscriminately firing on civilian neighbourhoods.

A local human rights group, Elman Human Rights, says more than 15,000 have died in the two-year conflict, while the UN says Somalia has 300,000 acutely malnourished children. Humanitarian projects have been shut down across the country due to the risk of attacks and kidnappings.

With files from the Associated Press