MOGADISHU (Reuters) - Mohamed Abdullahi Mohamed, a dual U.S.-Somali citizen and former prime minister, was sworn in as Somalia’s new president on Wednesday after lawmakers voted behind the secure blast walls of the capital’s airport.

Slideshow ( 14 images )

Celebratory gunfire erupted across Mogadishu at his victory, after a security lock-down in the seaside city aimed at deterring attacks by the al Shabaab Islamist group which had threatened to derail the Western-backed election process.

“President Farmajo,” residents shouted in the streets, using his popular nickname “Farmajo” which was used during the vote count. Many Somalis are best known by their nicknames.

Outgoing President Hassan Sheikh Mohamud, whose administration faced public and Western criticism for corruption scandals, conceded defeat as it became clear he could not win in a third round of voting.

“This is a victory for Somalia and the Somalis,” the new president told members of parliament shortly after taking the oath of office in a hall on the airport compound, which is surrounded by concrete barriers and guarded by African peacekeeping troops.

The voting process, which lasted months, began with 14,000 elders and regional figures choosing 275 members of parliament and 54 senators, who then had to choose among 21 candidates.

Pervasive corruption is one of the biggest complaints among ordinary Somalis and Western donors. Rival candidates accused each other of buying votes. Anti-corruption group Marqaati said tens of thousands of dollars changed hands in campaigning.

Western donors had said the voting process was far from perfect but marked a modest step forward from 2012 when just 135 elders picked the lawmakers, who then chose the president.

The threat from Islamist al Shabaab rebels, who regularly launch attacks in Mogadishu and elsewhere, meant the government and its Western backers scrapped a plan to give each adult a vote because of the challenge of securing polling stations.

As well as tackling the Islamist insurgency, the new president also has to deal with a severe food crisis in parts of the country, a young population demanding jobs and empty state coffers.

Born in 1962, Mohamed was prime minister from 2010 to 2011, when he slashed the size of the cabinet and was credited with appointing technocrats. He quit during a power struggle between the then president and parliament speaker.

One of his main campaign promises was to halt corruption in the aid-dependent nation. “If I become a president, Somali government officials will not misuse revenue,” he said in one speech.

Abdirashid Hashi, the director of Mogadishu-based Heritage Institute for Policy Studies who served in Mohamed’s cabinet, said the new president had a popular touch and was “not clannish or corrupt” in a nation where clan rivalries usually dominate politics.

He said the new president was a U.S. citizen who backed Republicans, the party of President Donald Trump. “If a Somali politician could make headway with the Trump administration, he might have chance make a go of it,” he said.

In the 1980s, the new president worked as a diplomat in the Somali embassy in Washington and lived in the United States for several years after that, including a period working for the New York State Department of Transportation.

(This story corrects formal name in paragraph 1 and throughout, clarifies “Farmajo” is the nickname by which he is popularly known.)