Mogadisgu - A former prime minister who holds dual Somali-US citizenship was declared Somalia's new president Wednesday, immediately taking the oath of office as the long-chaotic country moved toward its first fully functioning central government in a quarter-century.Incumbent President Hassan Sheikh Mohamud conceded defeat to former prime minister Mohamed Abdullahi Farmajo after two rounds of voting, saying that "history was made; we have taken this path to democracy".Fears of attacks by extremist group al-Shabaab limited the election to members of the upper and lower houses of parliament instead of the population at large. Lawmakers voted at a heavily guarded former air force base in the capital, Mogadishu, while a security lockdown closed the international airport.Thousands of cheering Somalis quickly poured into the streets in jubilation, chanting the new president's name. Cheering soldiers fired into the air. "Somalia will be another Somalia soon," said Ahmed Ali, a police officer celebrating in the crowd.Mohamud held a slight lead over Farmajo, 88 votes to 72, after the first round of 21 candidates, but Farmajo won the second round among the three candidates remaining, with 184 votes to Mohamud's 97.Corruption "This victory represents the interest of the Somali people. This victory belongs to Somali people, and this is the beginning of the era of the unity, the democracy of Somalia and the beginning of the fight against corruption," Farmajo said. "There is a daunting task ahead of me, and I know that."Farmajo, who is in his mid-50s and holds degrees from the State University of New York in Buffalo, was prime minister for eight months before leaving the post in 2011. When he was in office, al-Shabab was expelled from Mogadishu, his campaign biography says. He had lived in the United States since 1985, when he was sent there with Somalia's foreign affairs ministry.Somalia began to fall apart in 1991, when warlords ousted dictator Siad Barre and then turned on each other. Years of conflict and al-Shabaab attacks, along with famine, left this Horn of Africa country of about 12 million people largely shattered.Across Mogadishu, Somalis had gathered around TV screens at cafes and homes, eagerly watching the vote. "We need an honest leader who can help us move forward," said Ahmed Hassan, a 26-year-old university student.Somalia's instability landed it among the seven Muslim-majority countries affected by President Donald Trump's executive order on immigration, even though its government has been an increasingly important partner for the US military on counterterrorism efforts, including drone strikes against al-Shabab leaders.Political and economic recovery The new president, Farmajo, can travel to the United States on his US passport.In a sign of the dangers that remain in Mogadishu, two mortar rounds fired by suspected extremists late Tuesday hit near the election venue. There were no such attacks reported in the capital Wednesday and no public statements by al-Shabab.The international community pushed Somalia to hold the election as a symbol of strength, with the U.S. pouring in hundreds of millions of dollars in recent years for political and economic recovery. But the election was marred by reports of widespread graft in a country recently ranked as the world's most corrupt by Transparency International.The legislators voting — 275 members of the lower legislative house and 54 senators — were selected by the country's powerful, intricate network of clans. Weeks ago, a joint statement by the United Nations, the US, European Union and others warned of "egregious cases of abuse of the electoral process."With reports of votes being sold for up to $30 000 apiece, "This is probably the most expensive election, per vote, in history," the Mogadishu-based anti-corruption group Marqaati said in a report released on Tuesday.Tremendous challenges"We encourage Somalia's new administration to take credible steps to stamp out corruption and to establish strong electoral institutions to enable a free and fair one person one vote poll in 2020," State Department spokesman Mark Toner said as the US congratulated Farmajo.Tremendous challenges remain for Somalia and its new president, even beyond graft, al-Shabaab attacks and an economy propped up in part by the country's diaspora of more than 2 million people.An African Union peacekeeping force of more than 20 000 is making plans to pull out of the country by the end of 2020, leaving the job to national security forces that observers have said remain underprepared.Meanwhile, hundreds of thousands of Somali refugees are under pressure to return home as neighbouring Kenya's government seeks to close the world's largest refugee camp, Dadaab, by the end of May. Human rights groups have warned that Somalia is hardly equipped to support the returnees — especially as the United Nations and others warn that drought is creating a humanitarian crisis for almost three million Somalis.