Nigerians are so used to the idea that an incumbent should win presidential elections that President Goodluck Jonathan's failure to beat Gen Muhammadu Buhari needs some explaining. Here are five reasons why the opposition won:
1: Harder to rig
Past elections have been marred by serious irregularities and suspicions of rigging. In 2007 observers said the presidential poll was not "credible". In 2011 the vote was considered to be better run but observers said that rigging and fraud still took place.This time the electoral commission took more steps to prevent rigging, including new biometric voters cards.
Also President Jonathan's party, the People's Democratic Party (PDP), had lost control of some key states which meant it could not control the electoral process there.
2: Boko Haram and security
The poll was delayed for six weeks to give time for the security situation to improve, but even though most areas controlled by Boko Haram were recaptured, it seems to have come too late for many people.
3: United opposition, crumbling PDP
At the same time, the opposition managed to unite under the All Progressives Congress (APC) banner. The last six weeks of desperate and dirty campaigning, in which the APC responded in kind, was not enough to turn the tide.
4: Economy
National income is due to grow by more than 5% this year and next year, but people did not seem in the mood to thank Mr Jonathan for this.
5: Time for a change
President-elect Buhari now has to prove he really can change things.
-- BBC