Somalia's former Prime Minister Abdullahi Farmajo has won a landmark vote in Somalia in polls the international community hopes will mark the start of a new era of stability in the war-torn nation.

Farmajo took an early lead in the vote over incumbent Hassan Sheikh Mohamud, Reuters reported, over the course of an indirect voting process which took place in Mogadishu International Airport.

Outgoing Mohamud conceded defeat in the proceedings after he failed to secure a majority vote from 275 MPs and 54 senators who took part in the polls. "This is a victory for Somalia and the Somalis," Farmajo said in his first address as president.

It had been hoped that the vote originally, scheduled for 2016, could be held as a direct vote with full suffrage. However, the threat of attacks by the al-Qaeda linked group al-Shabab forced the poll to be held through an elaborate process of indirect votes.

When the final votes were tallied, celebratory gunfire echoed across the Somali capital.

Mohamed Abdullahi Mohamed
Former Prime Minister Mohamed Abdullahi Farmajo has been elected the President of Somalia Getty Images

As well as the threat of al-Shabab, Farmajo will have to negotiate his way through the country's fraught clan system. Bitter rivalries between the groups sparked Somalia's civil war which engulfed the country in 1991.

The new president will also have to deal with the legacy of the elections themselves. Millions of dollars are reported to have changed hands in the election, with parliamentarians candidates buying seats and votes for anywhere between $5,000 to $30,000 dollars (£3,990-£24,000). The AP reported that two of the seats for parliament members who will elect the president have gone for $1.3m apiece (£1m).

A Somali lawmaker casts her ballot
A Somali lawmaker casts her ballot during the presidential vote at the airport in Somalia's capital Mogadishu, February 8, 2017. REUTERS/Feisal Oma Reuters

The international community have criticised the ubiquitous corruption. The UN, US, and EU, who have adopted lock-step positions on Somalia, have referred in a joint statement to "egregious cases of abuse of the electoral process, including seats reserved for women candidates only that were ultimately taken by male candidates."

The scale of corruption means the elections have been a PR victory for al-Shabab, which have been seen to be above the backdoor politics.