(CNN) -- Ethiopia said Sunday it has withdrawn all its troops from Somalia, two years after the soldiers were deployed to prop up Somalia's transitional government.
Ethiopian soldiers man a position in Mogadishu, Somalia, in June.
The troops arrived in the Ethiopian border town of Dollow on Saturday and were greeted warmly by residents and officials there, the country's defense ministry told CNN.
As troops withdrew from around the Somali capital, Mogadishu, last week, forces from different Islamist groups -- including the hard-line Al-Shabab, which the United States has designated a terror organization -- took control of bases the Ethiopians abandoned.
"The city is almost under Islamist rule," said a local journalist who did not want his name revealed. "You can hear different names of the Islamist groups taking control in many parts of the city."
Ethiopia invaded Somalia in December 2006 to reinstall a U.N.-backed transitional government in Mogadishu after a hardline Islamist group overtook the capital and seized power.
Ethiopia's invasion had the blessing of the United States, which accused the Islamic Courts Union -- which captured Mogadishu earlier that year -- of harboring fugitives from al Qaeda.
The Islamists responded with a guerrilla campaign against government and Ethiopian troops. Efforts to replace the Ethiopians with an African Union-led peacekeeping mission faltered as the violence worsened, and heavy fighting in Mogadishu and other cities drove hundreds of thousands from their homes.
The lawlessness also spilled onto the seas off the Horn of Africa, where international vessels are routinely hijacked by pirates, suspected to be Somali, who demand large ransoms. And the transitional government was wracked by a power struggle between Prime Minister Nur Hassan Hussein and President Abdullahi Yusuf Ahmed, who resigned in December.
Ahmed attempted to fire Hussein for being ineffective. But Hussein said the president did not have the power to fire him, and the vast majority of members of parliament backed Hussein in a vote of confidence.
Hussein said last week that he would run for president, and lawmakers were expected to meet this week.