A surprise candidate, Sheikh Hassan Sheikh Mohamoud, has won Somalia’s first freely contested presidential election. The bigger surprise will be if his government proves any less corrupt or incompetent than the one it is replacing.

Somalia is the world’s premier basket case, with a stranglehold atop Foreign Policy magazine’s annual Failed States Index. It’s home base for the pirates of the Indian Ocean, an intermittent haven and recruiting ground for al-Qaeda, and the cradle of al-Shabaab, a jihadist sect that kills aid workers, conscripts children and until recently controlled the capital, Mogadishu, and most of the south of the country.

Somalia is also a place with great promise. It stands at a crucial trade crossroads, the portal between Arabia and East Africa (there’s a reason for those pirates). Despite the lack of a functional government for two decades, it has a bare-bones agricultural economy and even exports livestock. And it has oil -- maybe lots of oil: Up to 110 billion barrels underground and offshore estimated to be recoverable.

Mohamoud, a 56-year-old academic and civil-society advocate, was elected not by the Somali people but by the country’s 275-member Parliament, which itself was formed in recent weeks though a corrupt, nepotism-ridden process dominated by tribal leaders and members of the outgoing Transitional Federal Government.

It’s promising that, in the final runoff, Mohamoud defeated the transitional president, Sheikh Sharif Sheikh Ahmed, who oversaw a regime in which $7 out of every $10 of international aid ended up lining some power-broker’s pocket. (The unofficial national motto is “Maxaa igu jiraa,” meaning “What’s in it for me?”) Yet he will probably have less influence than the new Parliament speaker, Mohamed Sheikh Osman Jawari, an Islamist lawyer who was a minister under the dictator Mohamed Siad Barre in the 1980s.

Predatory Government

We don’t know much about either man, which is probably fine, because the new government is likely to be just as irrelevant as the old one, which Bronwyn Bruton, a Somalia expert with the Atlantic Council’s Ansari Africa Center, rightly calls a “predatory institution” that feasted on hundreds of millions of dollars of Western aid. Tax collection is virtually nonexistent; foreign aid is the only revenue source. The army is ragtag; a United Nations-sanctioned force of 17,000 African Union troops known as Amisom keeps al-Shabaab at bay.

Worst of all, there is no civil society, no economic structure, no legal or law-enforcement system, no education infrastructure, no forums for conflict resolution, and so on.

Perhaps the best news for Somalia is that it is of increasingly little relevance in the West’s fight against Islamic terrorism. Al-Shabaab is a spent force, now holed up in the port of Kismayo under shelling by the Kenyan navy. The African Union seems intent on maintaining its presence, and at less than $500 million a year -- a third of which comes from the U.S. -- Amisom is a relatively inexpensive lid on the powder keg. Al-Qaeda has been pretty much wiped out, and U.S. drones are ready should it re-emerge. Even piracy is on the decline, thanks largely to new security measures by shipping companies.

With the local war on terrorism winding down, perhaps the war on poverty can begin. There is no chance of political self-sufficiency or security until the country has a functioning economy. Americans -- the State Department, nongovernmental groups and businesses -- can best help by ending the welfare handouts to the central government and shifting aid and investment directly to projects that change the lives of average Somalis. With al-Shabaab mostly gone, a good first step would be for UN agencies and charity groups, which decamped from country after a rash of kidnappings, to get their peaceful boots back on the ground.

Smarter Aid

Turkey has taken the lead on smart development, not just pledging $300 million for projects including a children’s hospital and refugee camp, but also sending Turkish contractors and workers and their families to live in Mogadishu, bypassing corrupt aid-delivery mechanisms and ensuring that the projects will get completed. Turkey has reopened its embassy, hosted in June an international conference on Somalia’s future, created regional development offices to foster business links, and begun twice-weekly flights from Istanbul to Mogadishu on Turkish Air. The Chinese energy giant Cnooc Ltd. and smaller Canadian and Australian companies are already forging oil deals with the Somali government and that of the semiautonomous region of Puntland.

The U.S. could send a strong diplomatic message about the premium it puts on stability and self-sufficiency by recognizing the breakaway region of Somaliland as an independent state. The former British protectorate of 3.5 million people in the northeast corner of Somalia has been autonomous and relatively stable since 1991, surviving on remittances from its diaspora and fees from handling export shipments for landlocked Ethiopia. The benefit of recognition is that Somaliland would be able to negotiate trade deals with foreign states. The downside is that it would be eligible for its own foreign aid. As we’ve seen in Somalia proper, that can do a lot more harm than good.

Read more opinion online from Bloomberg View. Subscribe to receive a daily e-mail highlighting new View editorials, columns and op-ed articles.

Today’s highlights: the editors on a bolder plan to revive the housing market; Margaret Carlson on Republican efforts to suppress the vote; Clive Crook on why Germany’s currency nostalgia is off the mark; Peter Orszag on the money wasted in health care; Amity Shlaes on why Hoover haunts Romney but not Ryan; Richard Vedder on getting rid of college remedial education.

To contact the Bloomberg View editorial board: view@bloomberg.net.