The 72-year-old Buhari built an early lead in northern state [AP]
Nigeria’s election commission has declared Muhammadu Buhari the winner of the country’s bitterly contested presidential election, in a vote marred marred by confusion, arguments and violence.
Al Jazeera’s Yvonne Ndege, reporting from the capital Abuja, said the election commission made the announcement after nearly all votes had been tallied.
Incumbent President Goodluck Jonathan immediately conceded defeat and congratulated Buhari on his victory, the APC said.
According to the Reuters news agency, Buhari’s APC won by 2.1 million votes, with 15.4 million votes versus 13.3 for Jonathan and the PDP.
Victory for former military ruler Buhari marks the first time in Nigeria’s history that an opposition party has democratically taken control of the country from the ruling party.
Nigeria’s 2015 elections explained in one minute
Lai Mohammed, the spokesman for the APC, told the AFP news agency that his party had declared victory after pulling ahead in the votes.
“This is the first time the opposition has voted a government out of power in Nigeria’s history,” he said.
Asked if he was confident of having won after the APC claimed victory, Buhari said: “I am very confident.”
Read more of our indepth coverage on Nigeria’s election
To win the election, Buhari had needed to win more than 50 percent of the total votes nationally – and take at least 25 percent of the vote in two thirds of the states.
The 72-year-old built an early lead in northern states dominated by the mainly Muslim, Hausa-Fulani ethnic group of which he is a member.
Incumbent President Goodluck Jonathan, whose five years in office have been plagued by corruption scandals and an insurgency by Boko Haram fighters, was trailing by around 500,000 votes before votes in pro-opposition areas were counted.
In the previous election, more than 800 people were killed in protests after Buhari was defeated by Buhari.
There was a brief protest by Jonathan’s Peoples Democratic Party (PDP) before the counting had resumed on Tuesday.
Former Niger Delta minister Godsday Orubebe accused elections chief Attahiru Jega of being “partial” and “selective”.
Orubebe claimed Jega had refused to investigate PDP complaints about big wins by Buhari in northern states but had launched a probe into claims by the APC of irregularities in Rivers.
Jega said later: “I don’t believe that the allegations are substantial enough to require the cancellation or rescheduling of the elections in Rivers state. We will take the results.”
International observers gave broadly positive reactions to the conduct of the vote, despite late delivery of election materials and technical glitches with new voter authentication devices.
Nigeria’s Transition Monitoring Group, which had observers across the country, said: “These issues did not systematically disadvantage any candidate or party.”
His opponent, Goodluck Jonathan, has conceded defeat and called Gen Buhari to congratulate him on his victory.
Gen Buhari was ahead of Mr Jonathan by at least three million votes.
Observers have generally praised the election but there have been allegations of fraud, which some fear could lead to protests and violence.