Fela Kuti would surely have been delighted at the first peaceful handover of power in Africa’s biggest democracy, but horrified by the return of Muhammadu Buhari as Nigeria’s new president. Fela, Nigeria’s greatest and most influential musician, was a brave and outrageous political campaigner who spent much of his life furiously attacking his country’s successive military leaders. He was arrested 200 times by different regimes, but only kept in jail for a lengthy period of time by (then) Major-General Buhari, who first came to power in a military coup in December 1983.Fela was sentenced by a military tribunal to five years’ imprisonment on what he always insisted were trumped-up currency charges, but he was released after a year and a half, following another change of military regime.

Fela’s musician son Seun Kuti has since attacked Buhari, saying: “For you to jail that man you must be inherently evil.” Buhari was something of a quirky authoritarian: he became notorious for his “war against indiscipline” in which soldiers whipped commuters to make sure they formed orderly queues at bus stops, and civil servants who arrived late for work were ordered to perform frog squats. As for the charge that led to Fela’s imprisonment, it seems like a petty matter in which the musician was indeed innocent, but which was used by the authorities to keep him quiet. In September 1984, he and his band were at Lagos airport, waiting to leave for a major American tour. It was an important time for Fela. Since his death he has acquired the status of a global superstar, an African answer to Bob Marley, but in the mid-80s he was a major Nigerian celebrity who was still working to develop his following in the west. His career was effectively put on hold when he was found guilty of illegally attempting to export £1,600 in foreign currency – money that Fela said he had earned, quite legally, abroad.

According to his manager and friend Rikki Stein, he and Fela had been in London a short time earlier, and Fela “asked me to get him some money, and so I got £3,000 for him from the bank. This was money he had earned legally, out of the country, and when he returned to Nigeria he filled in the correct forms and declared it.”

When Fela prepared to leave Nigeria for the States, he again filled in the correct form, and declared the £1,600 he was taking out of the country. “When he handed in the currency form, he was asked for a tip by the official. Fela said he didn’t have any money on him and would catch him later. When another official discovered the money in a coat being carried by one of his party, the official who had asked for a tip then denied that he had seen the form.”

Such demands for money were not uncommon at the time, as those who travelled through the then-notorious Lagos airport will remember. But Fela’s case was special. The plane left without him, and he found himself under arrest and taken to a military tribunal. Fela drew the inevitable conclusion. Speaking to me in London after his release, he said that “they didn’t want me to go to the USA to play. They wanted to deal with me in a special way. They have dealt with me violently, and now they wanted to deal with my mind.” Looking back, Stein agrees: “This wasn’t something that had been planned in advance, but they had never had enough evidence before. Now they had this money.”

If the aim had been to silence a musician who had for years criticised Nigeria’s military rulers through his lyrics, onstage lectures and press conferences, then they had misjudged the situation. Amnesty International declared him to be a political detainee, and there were global campaigns for his release that involved musicians including the South African star Hugh Masekela, and US singer-songwriter Dan Del Santo, who recorded Free Fela. He was eventually released in April 1986, during the rule of General Babangida, who had overthrown Buhari in another military coup.

Soon after his release, Fela flew to the US, where he took part in the finale of Amnesty International’s Conspiracy of Hope tour, alongside Peter Gabriel and Jackson Browne. “Buhari would never have let him go,” says Stein, pointing out that when Fela was visited in prison by the judge who sentenced him, he confessed that he had been under pressure from the military government.

Fela Kuti in New York City, 1986. Photograph: Waring Abbott/Getty Images

Fela may have had a special reason to detest Buhari, but he had seen several other Nigerian military leaders attempt to silence him. In 1977, after he had embarrassed General Obasanjo by refusing to take part in a Pan African Cultural festival in Lagos, there was a military attack on the club and compound protected by an electric fence that he declared to be an independent state, the Kalakuta Republic. He said that his singers and dancers had been raped; his mother, who was thrown from a window, later died from her injuries.

Despite such experiences, Fela never gave up. When I last saw him in Lagos in 1994, three years before his death, he was still using his exhilarating music to attack corruption and the latest of Nigeria’s military regimes, this time led by General Sani Abacha. He was still a wildly controversial figure, and the authorities clearly feared him. The taxi driver who took me to his famous club The Shrine in Ikeja at first refused, saying we would be in trouble if my tape recorder was discovered and it was known I was going to interview Fela. The hot night air at The Shrine was heavy with marijuana, and when Fela himself appeared, in the early hours of the morning, he immediately attacked the military government, declaring “the head of state is not a citizen of Nigeria”.

But now, one of those military rulers who caused Nigeria’s greatest musical hero so much suffering and pain is again head of state, this time democratically elected by the Nigerian people in a largely peaceful election. So has Muhammadu Buhari really changed direction? Will he now allow criticism and free speech? Commenting on the election, Seun Kuti said that Buhari “trampled on the rights of my family when he jailed my father” but also that “I can forgive him if he begins to do to Nigerians what Fela would have liked … I would understand that, even if Fela were alive, [if] Fela sees Nigeria going forward, he would speak in favour of the man. But so far, I can’t betray my father based on some promises and some words.” And how did Stein regard the election result? “He’s claiming to be a born-again democrat. Let’s see.”