Nigeria election: Muhammadu Buhari set for victory Published duration 31 March 2015

image copyright Reuters image caption Gen Buhari's supporters have been celebrating as final results come in

Opposition candidate Muhammadu Buhari is on the verge of a historic victory over Nigerian President Goodluck Jonathan, with most votes counted.

Gen Buhari, a former military ruler, is ahead by almost three million votes, with results still to come from just three states.

Analysts say it is hard to see how Mr Jonathan can overcome this lead.

The opposition has never won a presidential election in Nigeria, Africa's most populous state.

Observers have generally praised the election but there have been allegations of fraud, which could lead to protests and violence.

More than 800 people were killed in protests after Mr Jonathan beat Gen Buhari in the previous election.

Results so far:

Gen Buhari: 14.2m votes;

Passed 25% threshold in 24 states

Mr Jonathan: 11.4m votes;

Passed 25% threshold in 24 states

Results from 33 states + Abuja

Candidates needs 25% in 24 states for first-round victory

BBC Hausa service editor Mansur Liman says that Delta is the only pro-Jonathan state still to declare, but his victory there is likely to be cancelled out once results come in from Gen Buhari's strongholds of Borno and Sokoto.

media caption BBC New looks at the facts and figures behind the Nigerian election

The announcement of results was briefly disrupted when an agent of Mr Jonathan's People's Democratic Party (PDP) launched a tirade against electoral commission (Inec) chairman, Attahiru Jega in Abuja.

"We have lost confidence in what you're doing, we don't believe in you any more," Elder Orubebe said.

Rejecting the allegation, Mr Jega replied: "Let us be careful about what we say or do and let us not dispute a process that has begun peacefully."

media caption As Peter Okwoche explains, results announcements in Abuja were disrupted

The candidate with the most votes will only avoid a run-off if they gain at least 25% of the votes in two-thirds of Nigeria's 36 states.

Gen Buhari's campaign spokesman Garba Shehu told the BBC: "We feel we have won because we have the numbers. We're in celebratory mood but we're not taking anything for granted because of the kind of government we have."

At the scene: Will Ross, BBC News, Abuja

There are long faces in the PDP camp. It looks like Muhammadu Buhari's lead may well prove too wide to be bridged.

But this is Nigeria and predictions are dangerous. The biggest surprise would be if the result is not disputed by the losing side.

During the vote, the card readers experienced some technical glitches, but they could prove to be decisive in ensuring the numbers could not be cooked and the views of Nigerians could not be ignored.

International observers have broadly praised the conduct of the vote but there has been some concern over possible efforts to rig the outcome.

The US and UK have expressed their concerns over potential "political interference" during the count.

A spokesman from Inec dismissed these fears, saying that "there is absolutely no basis" to talk of meddling.

Authorities in Rivers State announced a curfew on Monday night after protests over alleged vote rigging.

Mr Jonathan gained a landslide there but Mr Jega said that while the fact-finding team had found some voting irregularities with the poll there, they were not enough "to warrant a cancellation of the election".

Earlier, police in the state used teargas against female opposition protesters who were attempting to lodge complaints with election officials.

Voting spilled into a second day in some parts of Nigeria after problems were encountered with new electronic card readers, which were introduced to prevent fraud.

Nigeria at a glance:

image copyright EPA

Two main presidential candidates: Muhammadu Buhari , All Progressives Congress (APC), Muslim northerner, ex-military ruler, fourth presidential bid;

, All Progressives Congress (APC), Muslim northerner, ex-military ruler, fourth presidential bid; Goodluck Jonathan , People's Democratic Party (PDP), Christian southerner, the incumbent

, People's Democratic Party (PDP), Christian southerner, the incumbent Years of military rule ended in 1999 and the PDP has been in power ever since

Nigeria is Africa's largest economy and leading oil producer

With a population of more than 170 million, it is also Africa's most populous nation

President Jonathan, whose PDP has dominated Nigerian politics since 1999, was among those whose registration to vote was delayed by the technology.

Mr Jega said only a fraction of the 150,000 card readers being used nationwide had failed.

The National Human Rights Commission said 50 people were killed during the balloting, many of them in attacks by militant Islamist group Boko Haram.

As well as a president, voters are electing members of the house of representatives and the senate.