ABUJA (Reuters) - Nigeria’s President Muhammadu Buhari comfortably won a second term at the helm of Africa’s largest economy, election authorities said on Wednesday, but his main rival planned a fraud challenge after a vote marred by delays and violence.

The 76-year-old former military ruler took 56 percent of votes against 41 for his closest challenger, businessman and former vice president Atiku Abubakar of the People’s Democratic Party.

Atiku, 72, said he would go to court to contest the results due to a litany of “premeditated malpractices”.

Buhari has a daunting to-do list, from reviving an economy still struggling to recover from a 2016 recession to quelling a decade-old Islamist insurgency in the northeast.

Some 327 people died in election-related violence since the campaign began in October, 67 of them during or after Saturday’s vote, according to the Situation Room monitoring group and security sources.

The violence included insurgents’ attacks to disrupt voting, and clashes between gangs and security forces around poll centres.

Buhari, of the All Progressive Congress party, said he would reform the economy, combat graft and improve security, and urged supporters not to gloat or “humiliate” the opposition.

“We will continue to engage all parties. Our government will remain inclusive and our doors will remain open,” he said while receiving his election certificate.

Atiku rejected the outcome, saying one obvious red flag was that states in the northeast ravaged by insurgents’ attacks generated much higher voter turnouts than peaceful states.

“It is clear that there were manifest and premeditated malpractices in many states which negate the results announced,” he said.

That presaged a legal battle in a terrain where Nigeria’s most senior judge was controversially suspended by Buhari last month after allegations he breached asset declaration rules.

The move brought criticism that the government was meddling with judicial independence.

OVERTURNING RESULTS “VERY UNLIKELY”

Slideshow ( 9 images )

The opposition’s fraud accusations have heightened tensions in the region’s most populous nation and biggest oil producer where six decades of independence have seen long periods of military rule, coups and secessionist wars.

But the controversy could also just peter out, as happened recently after a presidential vote in Democratic Republic of Congo. “A legal challenge is very unlikely to overturn the official result,” said John Ashbourne, economist at Capital Economics in London, of the Nigerian election.

The president garnered 15.2 million votes to Atiku’s 11.3 million, on turnout of just 35.6 percent, the electoral commission said.

Slideshow ( 9 images )

The vote was delayed by a week after the commission was unable to get ballots and results sheets to all areas.

U.S. observers said that probably reduced turnout.

Buhari campaigned on pledges to fight corruption and overhaul Nigeria’s creaking road and rail network.

Analysts said he may find it easier to pass policies after Bukola Saraki, the former Senate president, lost his senatorial seat in local elections also held on Saturday.

Saraki nominally controlled parliament under the ruling party banner, but bitter disputes with the presidency saw the lawmaker often working to frustrate bills and budgets proposed by Buhari. He decamped to the opposition last year.

“Buhari is likely to get a friendlier Senate president, which could mean more efficient executive-legislative coordination,” said Amaka Anku, Africa director at Eurasia Group.

Buhari also has to deal with the threat from militants in the oil-rich southern Niger Delta region. The Niger Delta Avengers, whose attacks in 2016 pushed the economy into its first recession in 25 years, want their area to get a greater share of oil revenue it produces and had backed Atiku.

The Avengers had warned on Feb. 14 that they would cripple the economy if Buhari was re-elected. The group has not carried out any substantial attacks since January 2017.

“We would have to see if the Avengers will act on their threat. However, these militants are up for sale, so as long as they are granted their privileges they may not be a problem,” said Malte Liewerscheidt, West Africa analyst at Teneo.