Updated

Nigeria's president was declared the clear winner of a second term in Africa's largest democracy early Wednesday, after a campaign in which he urged voters to give him another chance to tackle gaping corruption, widespread insecurity and an economy limping back from a rare recession.

While many frustrated Nigerians had said they wanted to give someone new a try, President Muhammadu Buhari , a former military dictator, profited from his upright reputation in an oil-rich nation weary of politicians enriching themselves instead of the people.

Speaking shortly after the announcement of the official results and as many Nigerians awakened to the morning prayer, Buhari told colleagues that he was "deeply humbled" by the win. He also said he regretted the loss of dozens of lives in election-related violence.

Supporters began dancing in the streets of the capital, Abuja, on Tuesday night as vote counting stretched his lead from the weekend election to nearly 4 million votes over top opposition challenger Atiku Abubakar, a billionaire former vice president who made sweeping campaign promises to "make Nigeria work again."

Buhari received 15.1 million votes, or 55 percent, the electoral commission said in making its official declaration. Abubakar received 11.2 million, or 41 percent. The average national turnout was 35.6 percent, continuing a downward trend.

In a failed last-ditch effort to stop the official declaration, Abubakar's party claimed that election data had been manipulated and demanded fresh elections in four of Nigeria's 36 states.

Buhari's party rejected the accusations. It also called on Abubakar, who hasn't made a public appearance since Saturday's election, to accept his loss gracefully and concede. "Let this nation move forward," campaign spokesman Babatunde Fashola said.

"There's no opposition that will roll over and play dead. Anybody that lost an election will always complain," Hameed Ali, the ruling party agent attending the vote declaration, told reporters.

The election, once described as too close to call, suffered from a surprise weeklong postponement and significant delays in the opening of polling stations. While election observers called the process generally peaceful, at least 53 people were killed in an attack claimed by the Islamic State West Africa Province extremist group and other violence, analysis unit SBM Intelligence said.

It remained to be seen whether Abubakar will follow through on pledges to accept a loss, or challenge the results. A former U.S. ambassador to Nigeria, John Campbell, said the troubled election had given the candidates grounds to go to the courts. That route could take months.

Many Nigerians have prayed for peace. They were surprised in 2015 when President Goodluck Jonathan took the unprecedented step of conceding to Buhari before official results were announced. It was the first defeat of an incumbent president by the opposition in the country's history.

"Jonathan set the benchmark on how electoral outcomes should be handled," Chris Kwaja, a senior adviser to the United States Institute of Peace, a U.S. government-backed institution promoting conflict resolution worldwide, told The Associated Press. "Accept defeat in the spirit of sportsmanship. This is a critical vehicle for democratic consolidation."

Nigerians were praised for their patience and resilience in this bumpy vote.

___

Anna reported from Kano, Nigeria. Associated Press writer Sam Olukoya in Lagos, Nigeria, contributed to this report.

___

Follow AP's full coverage of the Nigeria elections here: https://www.apnews.com/Nigeria

___

Follow Africa news at https://twitter.com/AP_Africa