The Islamists, bolstered by powerful al-Shabaab hardliners, have regrouped
The Ethiopian army is preparing to leave Somalia almost two years after it invaded to oust Islamists who had taken control of large areas of the country.
The Ethiopians are withdrawing without having broken the power of what Prime Minister Meles Zenawi described in 2006 as the leaders of the jihadist movement, responsible for "terrorist outrages".
But the Ethiopian departure also marks a reverse for US President George W Bush's policy in the Horn of Africa.
It was the bombing of the American embassies in Kenya and Tanzania by al-Qaeda in 1998 - attacks that left hundreds dead and thousands wounded - that transformed Washington's approach towards the Horn of Africa.
America was convinced that Somalia, having been without a government since 1991, was an ideal conduit through which al-Qaeda could advance into the region from the Arabian peninsular.
At first, the US response was cautious, with memories of its previous intervention in Somalia in 1993, when the dead bodies of its troops were dragged through the streets of Mogadishu in an incident made famous by the film Black Hawk Down.
But after President Bush came to power in January 2001, all this changed.
In 2002, Washington established what was called the Combined Task-Force, Horn of Africa. Based in Djibouti, its 1,700 troops were there to fight terrorism in the region.
A year later, Washington allocated $100m (£70m) to an East African Counter-Terrorism initiative, described as an inter-agency task force working across the region.
But it was after 2005 that the United States really became directly involved in Somalia.
Concerned about the rise of the Union of Islamic Courts, America supported the creation of the Alliance for Restoration of Peace and Counter-Terrorism.
This brought together a group of Somali warlords who aided the US by snatching alleged al-Qaeda operatives taking refuge in Somalia.
The US is reported to have paid the warlords around $150,000 a month to support these operations.
Somalia is without a president after Abdullahi Yusuf quit last month
In June 2006, the Islamic Courts took power in Mogadishu and attempted to reach an accommodation with Washington.
This failed after hardliners in the Courts movement declared holy war against Ethiopia, following Addis Ababa's incursions into Somalia.
The senior US envoy to Africa, Jendayi Frazer, said publicly that the Islamic Courts were controlled by members of al-Qaeda.
"The top layer of the Courts are extremists. They are terrorists," she said.
Despite this, Washington attempted to prevent a full-scale Ethiopian invasion.
General John Abizaid was sent to Addis Ababa in 2006 to warn Prime Minister Meles that an invasion would be disastrous. It will become Ethiopia's Iraq, he is reported to have said.
The warning was brushed aside, and Ethiopian troops went in, driving the Islamists out of Mogadishu.
Whatever Washington's misgivings, there is little doubt that once Ethiopia was committed to an invasion, the US provided intelligence, military targeting and logistical support to Ethiopian forces in Somalia.
Ethiopia managed to install the internationally-recognised, but weak Transitional Federal Government.
At first, it appeared as if the strategy had succeeded. The Islamists were routed and continued to be harassed by Ethiopian forces.
But the Islamists, bolstered by some of the most powerful hardliners in al-Shabaab, regrouped and fought back.
The US military attempted to hit the hardliners whenever they emerged - using aircraft, warships and special forces to attack al-Shabaab on at least five occasions.
But the strategy has failed to break the hardliners.
When Ethiopia invaded, al-Shabaab had around 600 fighters. Today, intelligence sources suggest they number between 2,000 and 3,000.
Washington has said little about its covert war in Somalia, but it has little to show for years of effort and hundreds of millions of dollars.
With Somalia now without a president or an effective parliament, and with the Islamists stronger than before Ethiopia invaded, American policy towards the Horn appears to have run into the sand.