Nigeria's ex-military ruler Muhammadu Buhari will be the main opposition candidate in next year's presidential ballot after triumphing in a primary election, a televised count showed on Thursday.
Buhari will face President Goodluck Jonathan in the vote, scheduled for February 2015, which will be played out against a backdrop of economic woes and security fears tied to relentless violence being unleashed by Islamist militants.
"It is my pleasure to declare Muhammadu Buhari winner of the All Progressives Congress [APC] primary," the chief returning officer Fayemi Kayode told a cheering crowd in the national stadium in Lagos, Nigeria's commercial hub.
Buhari won 3,430 votes out of a total around 6,000 cast, with the governor of the northern Kano State, Rabiu Kwankwaso, coming second in the five-strong race with 974 votes. Former vice president Atiku Abubakar secured just 954 ballots.
Jonathan won the ruling party ticket on Thursday, with no challenger stepping forward from the ruling People's Democratic Party (PDP) to oppose him.
Buhari enjoys wide grassroots support, especially in the largely Muslim north, which has felt disenfranchised as power shifts to the more prosperous majority Christian south.
Himself a Muslim, Buhari took power in a coup in 1983. He is remembered as an iron-fisted ruler who executed armed robbers and drug traffickers, before losing power himself in a 1985 putsch. He is also seen as one of few Nigerian leaders who never used the top job to enrich himself or his supporters.
Jonathan's administration has been dogged by corruption scandals in the oil sector, some of which it has promised to investigate and others it denied, although it is hardly the first Nigerian government to be tainted with graft.
"We think General Buhari has already won the presidential election ... he is a clean man who can tackle corruption, which is at its highest peak," newspaper editor Kalani Muhammad told Reuters at the APC convention.
Jonathan has been lauded for making the boldest reforms in the power sector to date, including privatizing the rotten state provider, but the benefits have yet to be felt on the grid.
How Africa's biggest economy and leading energy producer conducts this election will be closely watched by investors and world powers, with political analysts predicting the closest fought race since the end of military rule in 1999.
Past polls have been marred by ballot-box stuffing, bullying and in some cases completely fictitious results, although the 2011 one was judged the cleanest yet.
The vote happens as Nigeria faces a falling currency and budget cuts linked to low oil prices, as well as a violent Islamist insurgency that has killed thousands.
Some 200 school girls kidnapped by Boko Haram militants in April remain in captivity and deadly attacks have been reported on a near daily basis in recent weeks, mostly in the north, exposing deep flaws in Nigeria's security forces.
Adding to regional tensions, northern elites feel Jonathan broke an unwritten "zoning" rule that the presidency should rotate between north and south every two terms when he ran in 2011. He had taken over from northerner Umaru Yar'Adua, who died in office in 2009.
Jonathan picked Vice President Nnamdi Sambo, a northerner, to run with him again.
Jonathan is the first president from the oil-producing Niger Delta, a region harboring an enraged sense of entitlement to the oil wealth that they live on, but from which they have seen scant benefits. If he loses, the militancy that disrupted oil production last decade until a 2009 amnesty could resurface.