Thirty years after he first took power in a military coup, Muhammadu Buhari has returned as Nigeria's newly elected president, vowing to take on the Muslim terrorists who kidnapped 270 Nigerian girls last April and recently pledged allegiance to ISIS.

“I assure you that Boko Haram will soon know the strength of our collective will and commitment to rid this nation of terror and to bring back peace and normalcy to all the affected areas," Buhari said in Nigeria’s capital city of Abuja. "We shall spare no effort until we defeat terrorism.”

The fourth time proved the charm for Buhari, who defeated incumbent Goodluck Jonathan in Nigeria’s March 28 presidential election after four days of vote tallying. Buhari had lost three previous elections.

Jonathan’s People's Democratic Party (PDP) had ruled the country since 1999 after it transitioned from military rule to democracy. This election marked the first peaceful transfer of power between civilian leaders in Nigeria’s history.

With all of Nigeria’s 36 states counted, Buhari defeated Jonathan by more than 2.5 million votes and won 55 percent of the vote within Africa’s largest nation of 177 million people. Despite his Muslim religious affiliation and ties to northern Nigeria, Buhari won states in the country’s southwest that previously sided with Jonathan, a Christian.

Buhari is from northern Nigeria, where Boko Haram has terrorized the local population, killing tens of thousands since 2009. The United Nations estimated Boko Haram killed more than 7,300 civilians in 2014 and caused more than a million more to flee their homes and escape to neighboring countries as refugees.

“Buhari has an unprecedented opportunity to recast the Muslim face of Africa at a time when violent terrorist movements have both perverted Islam and distorted Western foreign policies meant to be more multifaceted,” said Dr. Carl LeVan, a professor at American University, who witnessed the elections in Nigeria first hand.

Jonathan frustrated the U.S. military with his reluctance to send his military to confront Boko Haram. In December, Nigeria cancelled a training exercise with the U.S. Army, baffling the U.S. Embassy in Abuja.

However, he was gracious in defeat. "I have conveyed my personal best wishes to General Muhammadu Buhari. May God almighty continue to bless the Federal Republic of Nigeria. I thank you all,” he said.

President Obama, in a statement Wednesday, said, “I commend President Goodluck Jonathan and President-Elect Muhammadu Buhari for their public commitments to non-violence throughout the campaign….I urge [them] to repeat their calls to their supporters to continue to respect the election outcomes, focus on unifying the country, and together lead Nigeria through a peaceful transition.”

Thirty years ago, when he last led Nigeria following a military coup that lasted less than 20 months before another coup expelled him, Buhari had a reputation for brutal methods in attacking corruption and other issues - publicly executing young drug dealers on the beach, jailing journalists, and punishing bureaucrats who arrived late for work by forcing them to do squats and other physical tasks.

“We are very pleased with the results so far… the low level of violence,” said a State Department official who asked not to be identified when reached by Fox News. When asked if Buhari would be an improvement over the incumbent, he replied, “It remains to be seen, but I am optimistic for the population.”

“If [Buhari] is to be successful as a civilian chief of state, he is going to have to behave like a democratically elected president, not like a general who has been catapulted into the highest office,” said former U.S.ambassador to Nigeria John Campbell in an interview with Fox News.

Nigeria's elections gained attention as well when reports emerged that two firms connected to two high-profile Democratic strategists were advising the opposing candidates.

Joe Trippi - a former campaign manager for Howard Dean and a Fox contributor - advised Jonathan and the firm set up by President Obama's campaign adviser, David Axelrod, advised Bahuri. Axelrod himself had no involvement in the Nigerian election, according to the firm. He sold his ownership in the company in 2009.

Lucas Tomlinson is the Pentagon and State Department producer for Fox News Channel. You can follow him on Twitter: @LucasFoxNews