Nigeria's next president, the first opposition candidate to unseat a democratically elected president in the country's history, also knows how to take power through other means.

On Dec. 31, 1983, the military mounted a coup and Muhammadu Buhari, then a major general, became the country's leader.

Now 72, Buhari says he has undergone radical changes since those days and that he now champions democracy. After the coup, he ran an authoritarian regime until fellow soldiers ousted him less than 20 months later, placed him under house arrest and handed power to another major general.

Buhari's regime had executed drug dealers, returned looted state assets and sent soldiers to the streets with whips to enforce traffic laws. With oil prices slumping and Nigerians saying foreigners deprived them of work, Buhari's regime ordered an estimated 700,000 illegal immigrants to leave the country. Government workers arriving late to their offices were forced to perform squats.

His "war against indiscipline" won many followers, though his administration was criticized by others for detaining journalists critical of the government and for passing laws that allowed indefinite detention without trial.

"A lot of people will tell you that they have their reservations about Buhari for many reasons — some because he was a military dictator and they worry whether he can uphold democratic principles and create democratic space," said Kadaria Ahmed, a Nigerian journalist and political analyst.

This was Buhari's fourth bid to become president. A U.S. government official noted on Tuesday that Buhari was a good loser in those instances.

"Buhari has peacefully contested the last few presidential elections and accepted the results of those votes, even when he questioned the credibility of the process," a U.S. State Department official told reporters in Washington.

In this campaign, Buhari promised to introduce universal health care, a pledge that many say is extravagant and unrealistic.

Some Nigerians sickened by the growing corruption under President Goodluck Jonathan's administration say Buhari's image of honesty and strictness is what the country needs. In addition, his background in the military is seen as invaluable in the fight against Boko Haram, Nigeria's homegrown Islamic extremist group which has wreaked bloody havoc in northern Nigeria.

"Those who ... voted for him think he presented a much better proposition for Nigerians than the present government," Ahmed observed.

Some of Buhari's past stances haunted him in this election campaign, including statements in the 1980s that he would introduce Islamic Shariah law across Nigeria. A moderate form of Shariah was introduced in northern states in the 1990s but it operates alongside Western-style courts and only in majority-Muslim states.

Also there were criticisms of his leadership style, with some observers saying he delegated too much authority and if that continues they worry that his presidency could be hijacked and run by people around him.