By Paul Carsten and Alexis Akwagyiram
ABUJA (Reuters) - Nigerian President Muhammadu Buhari won a second term at the helm of Africa's largest economy and top oil producer, the electoral commission chairman said on Wednesday, following an election marred by delays, logistical glitches and violence.
He defeated his main opposition candidate Atiku Abubakar, a businessman and former vice president. Buhari secured 56 percent of votes, compared with 41 percent for Atiku, a candidate for the People's Democratic Party (PDP).
Buhari faces a daunting to-do list, including reviving an economy still struggling to recover from a 2016 recession and quelling a decade-old Islamist insurgency that has killed thousands of people in the northeast, many of them civilians.
Addressing supporters at the campaign headquarters of his All Progressive Congress (APC) party in the capital Abuja, he promised to tackle these issues.
"The new administration will intensify its efforts in security, restructuring the economy and fighting corruption," Buhari said after being declared the winner. He urged his supporters "not to gloat or humiliate" the opposition.
A message on Buhari's Twitter feed showed a picture of him waving to supporters and a simple message "4+4" as he embarks on his second four-year term.
The president won by 3.9 million votes, having garnered 15.2 million to Atiku's 11.3 million. The election turnout was 35.6 percent, the electoral commission said, which compared with 44 percent in the 2015 presidential election.
"Muhammadu Buhari of the APC, having satisfied the requirement of the law and scored the highest number of votes is hereby declared the winner," Mahmood Yakubu, chairman of the Independent National Electoral Commission (INEC), told election officials and reporters in the early hours of Wednesday.
Buhari's supporters gathered at the party's headquarters to celebrate, many of them holding flags and dancing.
"As a youth of Nigeria, I believe this is the way forward for this country and for my generation and that is why we choose to bring him back for the second time," said Juwarat Abubakar, a Buhari supporter.
Osita Chidoka, a representative of the PDP and its defeated candidate Atiku, repeated the party's stance that it does not accept the election result.
"We will explore all options including the belief that the legal process in Nigeria is one of the ways to resolve issues," he said.
Buhari's party has said the opposition was trying to discredit the returns from Saturday's election.
The accusations have ratcheted up tensions in a country whose six decades of independence have been marked by long periods of military rule, coups and secessionist wars.
Observers from the Economic Community of West African States, the African Union and the United Nations appealed to all parties to await the official results, expected later this week, before filing complaints.
The candidate with the most votes nationwide is declared the winner as long as they have at least one-quarter of the vote in two-thirds of Nigeria's 36 states and the capital, Abuja. Otherwise there is a second-round run-off.
Buhari secured enough votes to meet both requirements.
MARRED BY VIOLENCE
Analysts had forecast a tough race for Buhari, but his comfortable victory capped a remarkable turnaround.
Buhari, 76, took office in 2015 and sought a second term with pledges to fight corruption and overhaul Nigeria's creaking road and rail network.
Atiku, 72, had said he would aim to double the size of the economy to $900 billion by 2025, privatize the state oil company and expand the role of the private sector.
Voting took place after a week-long delay which the election commission said was due to its inability to get ballots and results sheets to all parts of the country.
The event - Africa's largest democratic exercise - was also marred by violence with at least 47 people killed since Saturday, according to the Situation Room, a monitoring organization linking various civil society groups.
Some deaths resulted from clashes between groups allied to the leading parties and the police over the theft of ballot boxes and allegations of vote fraud.
Police have not yet provided official casualty figures.
In his address, Buhari said he was saddened by the loss of lives during the elections and commended Nigeria's security agencies for their work "as severely overstretched as they are."
More than 260 people have been killed since the start of the election campaign in October. The toll so far is lower than in earlier elections, but the worst violence occurred previously only after results were announced.
The vote was also affected by problems with smart-card readers that authenticate voters' fingerprints. That meant voting in a small number of precincts was put off to Sunday.
U.S. observers said the week-long delay in holding the election damaged public trust in the process and probably reduced Saturday's voter turnout, while the European Union said the vote was hit by "serious operational shortcomings".
(Additional reporting by Camillus Eboh and Felix Onuah; writing by James Macharia and Alexis Akwagyiram; editing by Grant McCool and Neil Fullick)