With anger swelling over corruption, inequality and the devastating Boko Haram insurgency in the nation’s north, Nigerians have chosen a former general who once ruled with an iron hand to be their next president, according to election results on Tuesday.
The election has been the most competitive presidential race ever held in Nigeria, one of the largest democracies in the world.
Now, if power is handed over peacefully, it will be a major shift for the nation - the first transfer of power between civilians of different parties in a country that has spent much of its post-colonial history roiled by military coups.
With all but one of Nigeria’s 36 states counted, former military ruler Muhammadu Buhari held a lead of more than 2 million votes over President Goodluck Jonathan.
The remaining state is in the north, where Mr Buhari enjoys broad support and the government has been widely condemned for allowing the Boko Haram militant group to sweep through villages and towns, killing thousands of civilians.
Since the end of military rule in 1999, Nigeria has been governed by a single, dominant party - Mr Jonathan’s Peoples Democratic Party.
But on Tuesday, Mr Buhari’s campaign said it was confident it had won the election. Still, it warned the results could be manipulated.
“We knew that we had the numbers last night, but dealing with the type of government we have, we have never really felt we are out of the woods,” said Garba Shehu, a campaign spokesman for Mr Buhari’s All Progressives Congress party.
“Clearly we have won it. We are going to the party headquarters now and the presidential candidate will declare victory.”
Many analysts have said a victory for Mr Buhari would be more of a repudiation of the current president than a celebration of Mr Buhari’s past leadership.
On Mr Jonathan’s watch, Nigeria has been pummelled by the deadly Islamist insurgency in the north, its economic fortunes have plunged with falling oil prices, economic inequality is rampant and corruption scandals have buffeted the president’s image.
Mr Buhari has swept critical competitive states in the country’s southwest. A belated convert to democracy, Mr Buhari was also piling up large vote totals, as expected, in his northern stronghold, crushing the incumbent in Kano, Nigeria’s second-largest city.
Analysts said the election could mean the beginning of a competitive two-party system in a country often seen as a bellwether on the continent.
“It is very significant in our democratic growth, in grounding democracy and consolidating it,” said Ebere Onwudiwe, a political scientist with the Ken Nnamani Center for Leadership and Development.
"We can't have a one-party democracy. We're setting a very great example for the rest of the smaller states in Africa. "
But warnings on Monday from Britain and the US suggested it was too soon to say Nigeria had left its military-dominated past behind.
"So far, we have seen no evidence of systemic manipulation of the process," US secretary of state John Kerry and British foreign minister Philip Hammond said in a joint statement.
“But there are disturbing indications that the collation process - where the votes are finally counted - may be subject to deliberate political interference.”
A diplomat later explained that “credible reports” had been received “that the army has been asked to go to collation centres around Nigeria” in order “to intimidate” and that the request had come “from the ruling party and the presidency”.
The diplomat, speaking on the condition of anonymity to discuss a delicate matter, added, “We understood that the request had been made, and we were afraid it might happen. It may have happened.”
A spokesman for Mr Jonathan later denied any such interference. But military intervention has already occurred once in the election, when the country’s top security officers, who serve at the pleasure of Mr Jonathan, forced the electoral commission to delay the vote for six weeks.
Those extra six weeks of campaigning and spending gave the incumbent - with far more financial resources than Mr Buhari - a significant advantage, according to analysts.
It also allowed a last-minute offensive against the Islamist extremist group Boko Haram, with the deployment of South African mercenaries against the extremists.
The offensive reclaimed - for now, at least - much of the territory Boko Haram had held in the northeast.
The reclamation was also mounted with military help from neighbouring countries.
The Nigerian military has claimed the credit for the offensive, however, and a crucial question for the election’s immediate aftermath has been whether security forces would allow power to pass peacefully to Mr Buhari should Mr Jonathan be defeated.
With the vote count continuing, analysts said Mr Buhari had already made a strong showing, particularly in states in the south and southwest, “a really interesting bellwether of what may come”, said Darren Kew, a Nigeria expert at the University of Massachusetts at Boston who is observing the election.
“Those are fault-line states,” he said, “and the PDP” - Mr Jonathan’s party - “had a good machine on the ground there” that nonetheless failed to deliver for the president.
Mr Buhari’s supporters appear to have been more strongly motivated than those of a president, whose reputation has suffered from repeated corruption scandals in his government, as well as the mishandling of the Boko Haram insurgency.
In New York, a senior UN official told the Security Council on Monday that Boko Haram had killed more than 7,300 civilians in three states in northern Nigeria since the beginning of 2014.
The official, Kyung-wha Kang, the deputy emergency relief co-ordinator, said 1.5 million people had been displaced in Nigeria and neighbouring countries, making the insurgency one of the most pressing humanitarian crises in the world.
In Kano - where Mr Buhari led in the city and surrounding state by nearly 1.7 million votes - enthusiasm for the former general was “very, very high”, said Abubakar Jika Jiddere, a political scientist.
Indeed, polling places were packed on Saturday.
On Monday, the city’s normally teeming streets were emptied of vehicles and pedestrians as residents awaited the results.
This city has been attacked repeatedly by Boko Haram.
New York Times service