A man everyone calls Cheese won Somalia’s presidency on Wednesday, and the streets of the beleaguered capital, Mogadishu, exploded in cheers.
Mohamed Abdullahi Mohamed, a former prime minister, was chosen for the top job, capping a clan-based electoral process that had been widely criticized as corrupt even by Somali politicians who participated in it.
Mr. Mohamed, better known in Somalia by his nickname, Farmajo (from formaggio, the Italian word for cheese, for which his father was said to have acquired a taste when Somalia was an Italian colony), was considered the protest candidate and less manipulated by foreign interests than the departing president, Hassan Sheikh Mohamud.
Mr. Mohamed enjoys wide support within Somalia’s army. The moment his victory was announced, celebratory gunfire rang out in Mogadishu as soldiers across the city sprayed bullets into the sky.
Mr. Mohamed is rare on the Somali political scene for one reason: He is popular. Crowds of ordinary people poured into Mogadishu’s streets to cheer and whistle on Wednesday night.
As one Somalia analyst put it: The least corrupt and most-well-liked candidate won Somalia’s most corrupt and least democratic election. Go figure.
Somalia, which has lurched from crisis to crisis since the central government collapsed in 1991, did not hold direct elections.
Instead, Western donors helped set up a complicated indirect election in which Somalia’s regions and its myriad clans, subclans and subsubclans chose 329 members of Parliament, and those members of Parliament then voted for a president.
Western officials thought it too dangerous to hold direct elections because of the persistent threat from the Shabab militant group, which has killed thousands across East Africa. On Tuesday, the Shabab fired mortar rounds into the area in Mogadishu where the election was being held.
Mr. Mohamud, the incumbent, handily won the first round of voting, leading Mr. Mohamed by 88 to 72 votes in a field of more than 20 candidates. Many analysts said that Mr. Mohamud had built a huge war chest by receiving secret payments from Turkey, the United Arab Emirates and other countries, and that he used that money to line up votes ahead of time in Parliament. Many analysts considered it his election to lose.
Aid workers are now worried that millions of Somalis will soon face a famine; it would be the third one in 25 years.
In the second round of voting, the other presidential contenders threw their weight behind Mr. Mohamed. He won, 184 to 97.
Western diplomats quietly cheered on Mr. Mohamed, seeing him as the most organized — and least crooked — of the contenders.
But just about everyone agrees that Somalia still has a long way to go. The government provides few services and controls only small slices of territory. The only reason it controls any territory is the presence of thousands of African Union peacekeepers who have been battling the Shabab for years, taking heavy casualties.
Mr. Mohamed, who was born in 1962, had a good reputation as prime minister. As soon as he took office in 2010, he set up a payroll system for soldiers, shrank a bloated cabinet and spoke out against corruption, even though graft continued to blossom on his watch.
When he was pushed out less than a year later, as part of a bitter power struggle within the government, protests exploded.
Before entering politics, Mr. Mohamed worked as a diplomat for the Somali government and later for the New York State Department of Transportation in Buffalo. He holds American and Somali citizenship, and when he returned to his cubicle in Buffalo after his short stint as prime minister, his co-workers baked him a cake.