After his release and, he said, having seen the consequences of the break-up of the Soviet Union, Buhari decided to enter party politics, now convinced of the virtues of multiparty democracy and free and fair elections.
Despite this, Buhari always defended the 1983 coup, saying in 2005: “The military came in when it was absolutely necessary and the elected people had failed the country.”
He also rejected accusations that his measures against journalists and others had gone too far, insisting that he had been merely applying the laws that others had been breaking.
He was elected president in 2015, becoming the first opposition candidate to defeat an incumbent since the return of multiparty democracy in 1999.
As president, Buhari made a virtue of his “incorruptibility”, declaring his relatively modest wealth and saying he had “spurned several past opportunities” to enrich himself.
He was plain spoken by nature, which sometimes played well for him in the media and sometimes badly.
Although few doubted his personal commitment to fighting corruption and there were several notable scalps, some questioned whether the structures enabling mismanagement had really been reformed.
And attempts to improve youth employment prospects were, at best, a work in progress.
On the day Buhari left office, some Nigerians were asked in a video that was widely shared on social media, what they would remember most about his time in office, and all respondents said the same thing: ‘Bag of rice’.
The reason was simple – rice is the staple food in the country.
A standard 50kg (110lb) bag of rice, which could help feed a household of between eight and 10 for about a month, cost just 7,500 naira ($5; £3) under President Goodluck Jonathan, who was defeated by Buhari in 2015, but went up to 60,000 naira a few years afterwards.
This led to hunger in many parts of the country.
The huge surge in the price of rice was because, in an echo of his earlier policy as a military ruler, Buhari banned the importation of rice to encourage more Nigerian farmers to grow the crop.
However, local producers were unable to meet the high demand and many of his supporters lost their faith in him.
Ismail Danyaro, a resident of the northern city of Kano, said he had backed Buhari since he first contested the presidency in 2003.
“I used to buy a 50kg bag of rice under Goodluck [Jonathan] but when Buhari came, I found it difficult to buy even a 25kg bag of rice because it became so expensive,” he told the BBC.
At one point, even Buhari’s wife threatened not to support his re-election bid.

Buhari never accepted that his measures as military ruler were repressive or over-zealous
‘Baba go slow’
Nigerians love nicknames and some of the country’s leaders’ nicknames have stuck even long after they left office.
For example, former military leader Ibrahim Badamasi Babangida is still called “Maradona” for what people perceived as his tactical dribbles on issues and situations.
For Buhari, it was “Baba [Father] go slow” after it took him six months to name his first cabinet on assuming office in 2015.
Responding to his nickname years later, Buhari said it wasn’t his fault that it took so long to get anything done.
“Yes, we are slow because the system is slow. It’s not Baba that is slow but it is the system so I am going by this system and I hope we will make it,” he said in 2018.
Nigerian politics in 2022-2023 remains one of the most interesting in the country’s democratic history.
In the minds of many, it was the first time that a sitting president wasn’t really bothered about who his successor was going to be.
Openly, Buhari declared he would support whoever won his party’s (All Progressives Congress) nomination but insiders say behind the scenes he was ambivalent.
Buhari’s body language emboldened all five candidates seeking the APC’s endorsement and their supporters all went around saying they had his backing.
At one point it felt as if Buhari opposed the candidacy of his eventual successor, Bola Tinubu.
What followed was the declaration of the “naira swap policy” which the Buhari administration announced would, among other things, limit the influence of money in the 2023 elections.
Many Nigerians believed that the policy was targeted at preventing Tinubu from becoming president even though he had been chosen as the APC candidate.
The policy involved the confiscation of trillions of old naira notes and their replacement with new notes for the highest denominations.
However, there were not enough new notes, leading to shortages and suffering by millions, particularly the less well-off, who rely on cash for their daily transactions.
The policy was only suspended after a Supreme Court ruling, just days before the election.
Tinubu won narrowly, with 37% of votes cast, as the opposition was divided.
Any assessment of Buhari’s presidency must take account his declining health, which caused him to take significant absences from work, especially during his first term.
The former military ruler may have reinvented himself as a democrat but there was no such commitment to transparency concerning his own health, with Nigerians left uninformed about the fitness of their head of state for office.
Muhammadu Buhari married twice, first to Safinatu Yusuf from 1971-1988, and then in 1989 to Aisha Halilu, who survives him. He had 10 children.
(BBC)