Gunmen killed at least 15 people including an opposition politician near polling stations in northeast Nigeria on Saturday, casting an ominous shadow over the closest electoral contest since the end of military rule in 1999.
The tense race pits President Goodluck Jonathan against former military ruler Muhammadu Buhari for the favor of an electorate divided along a complex mix of ethnic, regional and in some cases religious lines.
The poll is seen as the first election in Africa's most populous nation in which an opposition candidate has a serious chance of unseating the incumbent, and widespread fears it could trigger violence are already becoming reality.
Islamist Boko Haram insurgents launched several attacks on voters in the northeast, killing three in Yobe state and three more in Gombe state, police said.
Shortly afterwards, at least eight people, including the opposition parliamentary candidate for Dukku in Gombe, were killed by unidentified gunmen, a spokesman for Buhari's All Progressives Congress (APC) said.
The militants, who are trying to revive a medieval Islamic caliphate in religiously mixed Nigeria, reject democracy and their leader Abubakar Shekau has threatened to kill those who go to vote.
A string of military victories by troops from Nigeria and neighboring Chad, Cameroon and Niger has reclaimed much of the territory the Islamists controlled earlier this year, but they retain the ability to mount deadly attacks on civilians.
The governor of Borno state in the northeast said 25 people had been killed in an assault on the remote village of Buratai on Friday night.
Voting at the 120,000 stations nationwide was beset with problems as officials turned up late and high-tech biometric card readers, introduced to prevent the vote-rigging that has marred previous polls, failed to work.
Even Jonathan suffered a 40-minute delay as officials vainly tried to get four different machines to recognize the president's fingerprint.
"I'm very hopeful," he said of his chances after voting.
With up to 56.7 million voters to process, the election commission said it would extend voting into Sunday in districts that had suffered technical problems. It was not clear what impact this would have on the timing of the result.
A credible and relatively calm poll would open a new chapter in the checkered history of Africa's biggest economy and top oil producer, whose five decades of independence have been tarnished by military coups and secessionist movements.
Voters queued for hours just to get accredited.
"They are extraordinarily patient," U.S. Assistant Secretary of State for African Affairs Linda Thomas-Greenfield told Reuters TV at a polling station in central Abuja. "We have to commend the Nigerian people for being so patient."
The vote is seen as a referendum on the record of Jonathan, a former zoology professor whose time in office has been blighted by massive corruption scandals and the Boko Haram insurgency in which thousands have died.
"These elections are a defining moment for Nigeria. ... People have a real choice," former Malawian president Bakili Muluzi, who is leading a Commonwealth observer mission, said.
"The danger is post-election. We've been assured by the peace accord between the leaders but how that trickles down is the danger," he told Reuters, referring to a second pact signed between Jonathan and Buhari on Friday not to whip up violence.
Yet the poisonous rhetoric emanating from both sides during the campaign, as well as some scuffles and shootings, have raised doubts over whether such agreements will be respected.
When Buhari, a northern Muslim, lost to Jonathan, a southern Christian, in 2011, it triggered rioting in the mostly Muslim north that killed 800 people and destroyed the homes of 65,000.
Before voting started, two bombs exploded at polling stations in the east, causing no deaths, while police destroyed a third. Hackers also shut the electoral commission website.
On Friday Jonathan told anyone planning violence to think again, yet many Nigerians queued up en masse to withdraw cash, buy fuel supplies and stock up at supermarkets.
In a climate of mutual suspicion, Buhari's APC also warned against any "devilish moves".
Buhari's top selling point is a belief he never stole during his 1983-85 rule, a rare feat for a top Nigerian politician, while his reputation as a military leader plays well with voters critical of the government's failure to quell Boko Haram.
However, his 18 months in charge, during which opponents were jailed and drug dealers executed, are not fondly remembered by all.
And as always in the nation of 170 million people, ethnic and regional sentiments remain paramount -- Buhari is hugely popular in the north, Jonathan, in the south and east.
That could leave the southwest as the king makers. The region, which centers around the commercial capital Lagos, is mostly ethnic Yoruba but religiously mixed. They voted for Jonathan last time but since then Yoruba elites have rallied decisively around Buhari.