There have been no elections in Somalia since 1967 and there won't be any this year either. But the country has a new parliament (appointed on the advice of clan elders) that has elected a new president, and the new government now actually controls the capital, Mogadishu. The world's only fully "failed state" may finally be starting to return to normality.
A failed state is a horrendous thing: no government, no army, no police, no courts, no law, just bands of armed men taking what they want. Somalia has been like that for more than 20 years, but now there is hope. So much hope that last month the United Nations Security Council partially lifted its embargo on arms sales to Somalia in order to let the new Somali government buy arms, and last week the U.S. government followed suit.
The new government replaces the Transitional Federal Government, another unelected body that had enjoyed the support of the UN and the African Union for eight pointless years. Then last year, a World Bank report demonstrated the sheer scale of its corruption: seven out of every 10 dollars of foreign aid vanished into the pockets of TFG officials before reaching the state's coffers.
Fully a quarter of the "national budget" was being absorbed by the offices of the president, the vice-president and the Speaker of parliament. The fact that after all that, the TFG still only controlled about one square kilometre (less than one square mile) of Mogadishu, while the rest of the shattered city was run by the Islamist al-Shabaab militia, an affiliate of al-Qaida, also contributed to the international disillusionment.
That tiny patch of ground, moreover, was being defended not by Somali troops but by thousands of Ugandan and Burundian soldiers of the African Union Mission in Somalia (Unisom). More than 500 of them had lost their lives defending the useless TFG, and the foreign donors were losing faith in the mission. But the Unisom soldiers did achieve one major thing: They fought al-Shabaab to a standstill in Mogadishu.
In August 2011, the Islamist militia pulled its troops out of the capital. That created an opening, and the international community seized it. It ruthlessly initiated a process designed to push the TFG aside: Somali clan elders were asked to nominate members for a new 250-seat parliament, which was then asked to vote for a new president and government.
It was obviously impossible to hold a free election in a country much of which was still under al-Shabaab's control, but this process also had the advantage that it allowed the foreigners to shape the result. The corrupt officials who had run the old TFG all reapplied for their old jobs, but none of them succeeded.
The new president who emerged from this process, Hassan Sheikh Mohamud, is a former academic and human rights worker who only entered politics in 2011. No whiff of corruption clings to him, and he has worked tirelessly to bring about national reconciliation. And he has the wind at his back: Just after he was chosen last September, a Kenyan force evicted al-Shabaab from Somalia's second city, Kismayo.
That still leaves about 95 per cent of the country's territory and three-quarters of its population beyond the government's direct control. Al-Shabaab still rules in most rural parts of the country, and Ethiopian troops and their militia allies control much of the western border areas. Pirates with a lot of guns and money effectively dominate much of the north.
The worst problem facing President Mohamud is the venal and cunning politicians who have exploited the clan loyalties that pervade every aspect of Somali life to carve out their own little empires. Some are frankly and unashamedly warlords; others, including all the senior officials in the defunct TFG, masquerade as national politicians but work for their own interests.
They have not gone away, nor have the clan rivalries that kept the fighting going for 21 years. Drawing up the rules and sharing out the power for a new federal Somalia (none of which has yet been decided) will give them plenty of opportunities to make trouble for the new president and regain their former power. Mohamud definitely has his work cut out for him.
Nevertheless, he has strong UN and African Union support, and he now has a chance to create a spreading zone of peace in the country and start rebuilding national institutions.
So last week the United States declared that it was now willing to provide military aid, including arms exports, to the Somali government. Weirdly, that actually means that things are looking up in the world's only failed state.
Gwynne Dyer is an independent journalist whose articles are published in 45 countries.