President Muhammadu Buhari of Nigeria after casting his vote in his hometown Daura on Saturday.CreditCreditBen Curtis/Associated Press
ABUJA, Nigeria — Officials declared early Wednesday that Muhammadu Buhari had won a second term as president of Africa’s most populous country, where voters rejected a corruption-stained candidate in favor of a leader who promised to continue a campaign to eliminate graft.
Not long after midnight, election officials finished counting the votes, making it apparent that Mr. Buhari had defeated the leading candidate, Atiku Abubakar, by a wide margin in an election that was marred by pockets of violence. He was declared the winner shortly before 5 a.m.
On Wednesday morning, Mr. Abubakar released a statement calling the results a “sham election” and saying that he would contest the outcome in court. He cited what he called a “statistical impossibility” of the results in some states — where turnout was high despite the fact that life there has been upended by war — as well as anomalies in states that are opposition strongholds.
Referring to violence in some states in the south where, he said, soldiers had fired on civilians, Mr. Abubakar added, “The militarization of the electoral process is a disservice to our democracy and a throwback to the jackboot era of military dictatorship.”
Local civil society groups had also ticked off lists of irregularities during the voting. At one point Mr. Abubakar’s had party demanded a halt to the counting. Some international observers had indicated earlier in the week that the problems likely hadn’t been widespread enough to sway the outcome.
But violence did punctuate the voting on Saturday, and civil society groups decried the deaths of at least 39 people killed across several states. One of the victims was a young election worker struck by a stray bullet.
Also on Wednesday morning, Mr. Buhari said he planned to keep working to improve security and the economy, and to fight corruption. He asked supporters “not to gloat or humiliate the opposition. Victory is enough reward for your efforts.”
Nigeria’s election was in many ways a referendum on honesty, as voters once again embraced a candidate who held up a broom at rallies, declaring to sweep away the graft that has given the nation a bad reputation worldwide.
It was also a tribute to the power of incumbency. For all Mr. Buhari’s talk of fighting corruption, some prominent suspects — including a governor caught on camera handing out a bribe — have gone unprosecuted under his regime. Critics say he targeted political opponents in his antigraft inquiries.
Yet the president, who is 76, managed to overcome his deficits, and in some ways benefited from them. Turnout was low on Election Day, a factor that buoyed the president’s fortunes since his loyalists were among those who bothered to vote in a race that had once been too close to call. Some analysts said many voters had stayed away from the polls because of despondency over the failures of the past four years.
“There’s a growing sense of disconnect between the Nigerian people and the political elite,” said Hussaini Abdu, chairman of the Youth Initiative for Advocacy, Growth and Advancement, a team of local observers, speaking before the results were announced.
Another factor was that election officials decided to delay the vote by a week just hours before polls were to have opened. Numerous registered voters had made long journeys to their home districts to vote, because Nigeria has no absentee balloting system. When officials postponed the election, many people simply gave up and returned home.
Voters rejected Mr. Abubakar, 72, a former vice president who was considered so corrupt by the United States that he was refused a visa for many years.
But Mr. Abubakar’s campaign focused on an issue that resonated with many voters: improving the economy. His raft of proposals included privatizing some government operations and floating the currency.
Many people blamed Mr. Buhari for his decisions during a currency crisis that launched Nigeria into recession. Yet it was also under his watch that the nation lifted out of recession in 2017. Progress since then has been slow, however, and unemployment has climbed.
Last year, Nigeria, one of the world’s largest oil producers and Africa’s biggest economy, was named the nation with the largest number of people living in extreme poverty.
In the weeks leading up to the election, it was unclear which candidate had leverage in a race that had more than 70 candidates on the ballot. It came down to two members of the political establishment in their 70s. Mr. Abubakar received more votes than Mr. Buhari in the area that makes up the capital city. Fiery rhetoric flew on both sides — Mr. Abubakar called Mr. Buhari a dictator at one point — and after the election each side accused the other of vote-rigging.
But many Nigerians see Mr. Buhari as an honest man. Unlike others in the political establishment, he has not enriched himself with money from the public treasury. His soft-spoken demeanor stands out among more flashy, blustery politicians.
Mr. Buhari made headway in cleaning up graft, appointing a team that arrested political figures, seized millions of dollars and jailed corrupt officials. But critics said that his targets were his political opponents. He brushed off charges of corruption against his allies, who were not prosecuted.
His victory is “a popular call to be more evenhanded with his anticorruption campaign,” said Dr. Sadeeque Abba, a political-science professor at the University of Abuja.
Mr. Buhari captured the vote of northerners who viewed him as a son of the region, though Mr. Abubakar also hails from the north. But Mr. Buhari has paved roads in rural areas where crops and animals had been brought to market on crumbling highways.
Mr. Buhari’s health likely will be on voters’ minds. He was absent from Nigeria for several months in 2017 when he sought treatment in London for an illness he never disclosed to the public.
While Mr. Buhari failed to keep some of his early promises, especially in cracking down on terrorism, many voters still see the former general, who led the nation under military rule in the 1980s, as a strongman with the credentials to fight Boko Haram, the Islamist militant group ravaging the country’s northeast.
Boko Haram has launched more complex attacks against military installations in recent months, and on the morning of Election Day a faction loyal to the Islamic State fired rockets at the biggest airport in the area. Mr. Buhari has told the public several times that the group has been defeated.
Mr. Buhari also had promised to crack down on human rights abuses, but reports of impunity are a regular feature of Nigerian life. Security forces have opened fire on unarmed protesters on several occasions, with high body counts. Rapes by security forces of women and teenagers in camps for people fleeing war have gone uninvestigated.
Mr. Buhari’s armed forces also stormed the main office of a major newspaper in January, seizing laptops and cellphones. His campaign adviser indicated in an interview on Tuesday that Africa’s largest democracy may face further clampdowns.
“The right to free speech must be subordinated and subjugated to the right to national security,” said Babatunde Fashola, who is also the minister of power, works and housing.
Mr. Buhari’s efforts so far have failed to quell battles over land between farmers and herders, or armed gangs carrying out kidnappings and killings.
And lost in the fray of the election were the high-profile kidnapping victims of Boko Haram, including the remaining students from Chibok who were kidnapped nearly five years ago. Mr. Buhari had promised to free all of them.
Though he helped broker the release of about half of the missing students, more than 100 remain held by militants. Those students and others who have gone missing during the nearly decade-long war seem forgotten by the many Nigerians who live in cities far from the fighting. Unity Fountain, the site where #BringBackOurGirls protesters once marched regularly, is often empty.
Only a giant broom remains there in place of the protesters, stuck in the ground as a reminder of the president’s anticorruption pledge.
Tony Iyare contributed reporting from Lagos, Nigeria.