ABUJA, Nigeria -- Nigerians celebrated Muhammadu Buhari's electrifying victory in presidential elections Wednesday but sobering challenges confront their next leader, from an Islamic uprising to widespread poverty and graft.

Buhari, 72, made history in Africa's most populous country as the first opposition party candidate to win elections, ending President Goodluck Jonathan's bid for another term. For a former major general who three decades ago led Nigeria following a coup, it was an amazing transformation to a democratically elected president.

Fresh from his victory, Buhari warned the country's Boko Haram Islamic insurgents that he'd be coming after them.

"No doubt this nation has suffered greatly in the recent past and its staying power has been challenged to its limits, chief among them the insurgency of Boko Haram," he said Wednesday at Abuja's international conference centre where he received a certificate attesting to his victory. "Boko Haram will soon know the strength of our will and commitment to rid this nation of terror ... we shall spare no effort until we defeat terrorism."

Boko Haram aims to establish a caliphate and to turn Nigeria into an Islamic state, has killed thousands of civilians and carried out frequent kidnappings but has been hit hard in recent weeks by troops from Nigeria and allied forces from neighbouring Chad, Cameroon and Niger.

The bespectacled president-elect also warned that corruption would not be tolerated after he takes office on May 29. As Nigeria's leader three decades ago, he returned looted state assets. Government workers arriving late to work were even forced to perform squats. His regime executed drug dealers.

"Corruption attacks and seeks to destroy our national institutions and character ... distorts the economy and creates a class of unjustly enriched people," Buhari said Wednesday, wearing splendid white robes with gold embroidery. "Such an illegal yet powerful force soon comes to undermine democracy because it has amassed so much money that they believe they can buy government."

Buhari had ruled Nigeria for less than 20 months before being deposed in another coup in 1985, with another major general saying Buhari had been slow to overcome the nation's economic problems.

It may be deja vu for Buhari when he takes over the presidency because the economy, Africa's biggest, is suffering again because of low oil prices. Nigeria is Africa's biggest oil exporter and the government is heavily dependent on oil sales for its revenues. The 2015 budget had to be slashed because of slumping oil prices. The value of the local naira currency is also dropping.

Jonathan's party has governed since military dictatorships ended in 1999. Buhari has been trying to be president since then and this was his fourth run at the presidency.

New scanners to confirm voters' biometric identity cards are credited with reducing voting fraud, which had been a factor in previous elections. However some of the machines did not work at about 300 of the 150,000 polling stations.

Jonathan conceded with grace late Tuesday, saying "I promised the country free and fair elections. I have kept my word."

In a continent where there have been cases in which a sitting president refused to accept defeat at the polls and violence resulted -- Ivory Coast in 2011 is an example -- the turn of events in Nigeria was good news that was welcomed by many Nigerians and foreign leaders alike.

In the northern city of Kaduna, thousands celebrated in the streets, shouting "No Boko Haram! No Boko Haram!" The demonstrators danced and held up posters of Buhari and waved brooms, his symbol to sweep out corruption. Motorbikes and cars did stunts and dozens climbed onto a police car as police looked on.

"President Jonathan has placed his country's interests first by conceding the election and congratulating President-Elect Buhari on his victory," U.S. President Barack Obama said in a statement. "I look forward to working with President Jonathan throughout the remainder of his term, and I thank him for his many years of service and his statesmanlike conduct at this critical juncture."

Jonathan's concession has defused tensions and fears of post-election violence. Some 1,000 people died and 65,000 were made homeless in riots in the Muslim north after Buhari lost to Jonathan in 2011. Results from Saturday's election show Buhari winning votes across religious, tribal and geopolitical lines.

Because of decades of military rule this was only the eighth election in Nigeria's history and the fifth since democracy was restored in 1999.