Muhammadu Buhari
Former military dictator and Nigeria's newly elected president Muhammadu Buhari waves to supporters in Lagos. Pius Utomi Ekpei/AFP/Getty Images

The results are in and Nigeria has decided. Former military ruler Muhammadu Buhari of the All Progressives Congress will be the next leader of Africa's richest and most populous nation. President Goodluck Jonathan, who was seeking a second full term, called Buhari Tuesday to congratulate him on the election victory and conceded defeat in the bitterly contested race, Reuters reported. Jonathan’s sinking popularity gave way to Buhari’s fierce campaign on security and anti-corruption, which helped him win crucial states in the north and south.

Lagos state, the former capital, southern economic hub and Africa’s most populous city, was a crucial win for Buhari, a northern Muslim. The opposition candidate took 792,460 votes in the key swing state while Jonathan of the Peoples Democratic Party won 632,327, according to the Vanguard newspaper.

Buhari also scored crushing defeats in the northern Muslim states of Kaduna and Kano, which neighbor his home state of Katsina. He took Kaduna with more than 1.1 million votes to Jonathan’s 484,085, according to the Premium Times in Nigeria. Buhari also won more than 1.9 million votes compared with Jonathan’s 215,779 in Kano, Nigeria’s second most populous state and one of the areas hit hardest by Boko Haram insurgents, the Associated Press reported.

Buhari, 72, tried to distance himself from his authoritarian past during his campaign, insisting he was a reformed democrat. But he has played up his military background as credentials for defeating Boko Haram and improving national security. Buhari’s pledge to reinforce Nigeria’s army and wipe out the Islamist insurgents from the northeast may have given him an edge in Kano, Borno and other northern states that are frequently under attack.

Meanwhile, Jonathan and the long-ruling PDP have lost popularity over allegations of corruption. Under Jonathan’s administration, more than 70 percent of the federal budget is spent on the salaries and benefits of public officials. Buhari cracked down on corruption after he took power in a military coup in 1983. Three decades later, Buhari has vowed as president to be tough on crooked politicians and plug budget holes.

The U.S. government showed a cautiously optimistic view of the ex-military dictator, who has run in Nigeria’s presidential elections since 2003. "I would reiterate that the U.S. is ready to work with whichever candidate the Nigerian people elect through the democratic process," a U.S. State Department official told Reuters Tuesday. “Buhari has peacefully contested the last few presidential elections and accepted the results of those votes, even when he questioned the credibility of the process.”

The presidential inauguration is scheduled for May 29.