Results from Nigeria's election are due from early next week, with the winner gaining control of Africa's most populous nation
Nigerians on Saturday waited to hear who their next president will be as voting in delayed elections drew to a close and the counting began.
Results from nearly 120,000 polling stations were being collated at local and state level before being sent to the capital, Abuja, on Sunday.
The chairman of the Independent National Electoral Commission (INEC), Mahmood Yakubu, will officially announce the outcome from early next week.
Whoever wins will gain control of Africa's most populous nation and leading oil producer for the next four years but also face a daunting to-do list, from widespread insecurity and endemic corruption to an economy recovering from recession.
The count began even as many people had yet to cast their ballot because of delays in the opening of polling units and problems with staffing and technology.
In some places, voting continued as darkness fell because papers, results sheets and other materials did not arrive until mid-afternoon or handheld voter card readers failed.
INEC said it was "generally satisfied" with the vote, although a decision would be made about how to proceed in about 8,500 polling units where voting was not possible.
That raised the prospect of voting going into a second day, as in 2015.
The incumbent, Muhammadu Buhari, voted in his home town of Daura, in the northwest state of Katsina, and said he was confident of victory.
"I will congratulate myself," he told reporters. "I'm going to be the winner."
His main challenger, Atiku Abubakar, 72, voted in Yola, in the northeastern state of Adamawa, and said he was "looking forward to the transition".
Former president Goodluck Jonathan, who won plaudits for conceding to Buhari in 2015, said after casting his ballot: "I can only encourage people when they lose to accept it."
- Violence -
Just hours before polling began, Boko Haram's Islamic State-backed faction launched a rocket attack on the northeastern city of Maiduguri that killed one soldier.
There were several clashes between jihadists and soldiers elsewhere in Yobe and Borno states, where more than 500 Chadian troops arrived as backup.
Civil society groups monitoring the vote meanwhile said 16 people were killed in election-linked violence in eight states -- a relatively low number compared to previous polls.
INEC postponed voting just hours before it was due to get under way last Saturday, angering voters who had already travelled to their hometowns and villages to participate.
The delay saw the main parties accuse each other of conspiring with the INEC to rig the result, although neither has produced evidence.
The elections watchdog has since worked round the clock to overcome difficulties in delivering materials, which it had blamed for the postponement.
- Security fears -
INEC's logistical fine-tuning was overshadowed by comments from Buhari that he had ordered security forces to be "ruthless" with vote-riggers and ballot-box snatchers.
Critics said his warning was a "licence to kill" to the police and the military, while Abubakar said his comments did not befit an elected head of state.
Analysts SBM Intelligence say 233 people were killed in 67 incidents of election-related violence from last October to Friday -- an average of two people per day.
In southern Rivers state, unknown gunmen shot dead a prominent local member of Buhari's All Progressives Congress party and his brother, police said.
There were also sporadic incidents of snatching election materials and vote-buying but most voting was peaceful.
The election campaign came against a backdrop of wider violence from Boko Haram and criminal gangs in the north that have killed more than 200 people this month alone.
Analysts said that and the delay could hit turn-out.
A total of 72.7 million people with voter identity cards were eligible to vote. Parliamentary elections were held at the same time.
- Task ahead -
In 2015, former military ruler Buhari became the first opposition candidate in Nigerian history to defeat a sitting president, beating Goodluck Jonathan by 2.5 million votes.
Buhari has again vowed to be tough on insecurity and corruption, and wants to complete much-needed road and rail infrastructure projects, as well as social mobility schemes.
Abubakar is a pro-business free marketeer whose main pledges have been to privatise giant state-run companies and float the embattled naira currency.
Nigerian elections have previously been characterised by voting along ethnic and religious lines.
But with Buhari and Abubakar both northern Muslims, that could split the northern vote, making southern states a key battleground.
Opponents have accused Buhari of trying to manipulate the judiciary that would rule on any dispute about the results, after he suspended the chief justice this month.