The runner-up in Nigeria’s presidential vote has rejected the result of what he called a “sham election” and vowed to challenge the outcome in court.

Opposition candidate Atiku Abubakar alleged there had been “manifest and premeditated malpractices” during a vote which saw president Muhammadu Buhari comfortably secure a second term at the helm of Africa’s largest economy.

The electoral commission on Wednesday declared Mr Buhari the winner of Saturday's election by four million votes. The 76-year-old former military ruler was backed by 56 per cent of the electorate, the commission said.

Mr Abubakar, the People’s Democratic Party candidate, said he would have conceded “within seconds” if the election had been free and fair.

The businessman and former vice-president, who took 41 per cent of the vote, claimed voting was suppressed in his strongholds in the south. He said another red flag was that states in the northeast that have been ravaged by extremist attacks saw much higher voter turnouts than peaceful states.

Nigeria delays 2019 presidential election Show all 4 1 /4 Nigeria delays 2019 presidential election Nigeria delays 2019 presidential election Paramilitary forces stand near Daura, native home of Nigerian president Mohammadu Buhari AFP/Getty Images Nigeria delays 2019 presidential election Former vice-president and presidential aspirant Atiku Abubakar speaks in Lagos AFP/Getty Images Nigeria delays 2019 presidential election Staff members of the Independent National Electoral Commission (INEC) unload ballot boxes in southern Nigeria AFP/Getty Images Nigeria delays 2019 presidential election Police officers attend the posting parade for the elction in southern Nigeria AFP/Getty Images

"I have never seen our democracy so debased", the 72-year-old added in a statement shared with supporters."It is clear that there were manifest and premeditated malpractices in many states which negate the results announced."

Some 327 people died in election-related violence since the campaign began in October, including 67 killed 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 polling booths.

Opposition candidate Atiku Abubakar talks to the media after casting his ballot in the presidential election (EPA)

The vote had been delayed by a week after the electoral commission was unable to get ballots and results sheets to all areas of the country. International observers said that probably reduced turnout.

Mr Buhari, of the All Progressive Congress party, had to improve security and reform the economy if re-elected. He urged supporters not to gloat or "humiliate" the opposition after his victory.

"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.

The opposition's fraud accusations have heightened tensions in Africa's most populous nation, where six decades of independence have seen long periods of military rule, coups and secessionist wars.

But the controversy could also peter out, as happened recently after Democratic Republic of Congo's presidential vote in December.

John Ashbourne, economist at Capital Economics in London, said a legal challenge over the Nigerian election was "very unlikely to overturn the official result".