(CNN)The victory of a 72-year-old former general, Muhammadu Buhari, in the Nigerian elections represents a moment of maturity in West African politics. Buhari, who some 30 years ago was Nigeria's harsh military leader, could of course prove to be a disaster; so many self-described reformers have been. swath . But the peaceful transition of power from President Goodluck Jonathan to President Buhari is the first of its kind in history. And the fact that the winner ran on an anti-corruption platform suggests that ordinary Nigerians have finally had enough of the venality of their elites. For too long, Nigeria's poor have been victims of their country's enormous wealth. The cancer of corruption has to be cut out. I visited Nigeria in January and found a country under siege. Abuja, the capital city, is where the rich have always imagined themselves making their last stand. Soldiers guard the treacherous motorways; houses are compounds covered in barbed wire. It's a place where poor children rise at dawn to sift through the trash cans for food and black magic is practiced by the side of the road at dusk. Yet thanks to Nigeria's oil, there is also tremendous wealth in Abuja. And when you don't really make money but simply take it from the soil and sell it, a crude kind of crony capitalism develops in which who you know is far more important than what you know. Graft trickles down through the system; through family, through patronage and through shady deals done with foreign businessmen at the 24-hour party palace at the Abuja Hilton Hotel. The richest buy off the anger of the poorest, and vast swaths of society become complicit in the crime. For a while, that system brought some stability to the government of  Jonathan. But stability was contingent upon oil remaining at $110 a barrel, and in recent months the price has collapsed to below $50 a barrel. Lacking funds, the government could no longer promise jobs to voters and had to start thinking creatively about serious economic development. One was the massive privatization of the power system, a sensible idea that promised to take energy provision out of the hands of a broken state and give it to businessmen to run. The problem is that costly investment and redevelopment didn't come soon enough: Millions were left without power and the government's few bold attempts at reform smacked of betrayal. The problem of corruption went hand-in-glove with the rise of terrorism. Nigeria is not a natural, comfortable nation state; it's composed of many ethnicities and two major competing religions. The south is dominated by Christians like Jonathan, the north by Muslims like Buhari. And the north has witnessed a brutal, bloody terrorist insurgency led by Boko Haram, which translates as "Western education is forbidden." Westerners might assume that Boko Haram's major target is the Christian south but, in fact, its war is as much against nonfundamentalist Muslims as it is non-Muslims, and its attacks have generally been focused on Islamic population centers. Failure to deal with this has not entirely been due to Boko Haram's strategic ingenuity. Previous administrations have simply been too dysfunctional to fight a war on terror. In 2010, for instance, the government awarded a $470 million contract to provide security in Abuja. Few of the promised cameras were installed, yet the money was still paid in full. And soldiers sent to the front report being poorly equipped. The government is thought to have resorted to trying to purchase arms on the international black market, according to news reports -- although this is the kind of story that is hard to verify due to bans on granting visas to foreign journalists (I was in Nigeria as a consultant on a business visa). What is directly observable is that while the government proved capable of providing security in some areas, in others it utterly failed. And the Jonathan government might have benefited from the Boko Haram terrorist emergency continuing in Muslim centers, for the Muslims were far more likely to vote for Buhari. For Buhari to win, he had to draw large numbers of votes in Christian areas -- and there, again, a Western prejudice is challenged. The victory of a Muslim candidate in Nigeria does not represent the victory of Islamism, as we have so often been told by those skeptical of the ability of the Muslim world to govern itself. On the contrary, Buhari is associated with an earlier period in Nigerian history when the army was relatively well paid and respected. He ran the country in the early 1980s along dictatorial lines, for sure. But he also ran a War Against Indiscipline when in power in which civil servants who were late to work were ordered to do frog jumps, drug dealers were publicly executed, and some 474 politicians and business were arrested on charges of corruption. Buhari was removed in a coup, and he left office with the rare distinction of not having made very much money from it. Now he has won the presidency promising to tackle those intertwined problems of Boko Haram and corruption. Get the army functioning properly again, Nigerians hope, and it will be able to drive back the fundamentalists. Buhari has his critics, many of whom charge him with misrepresenting his CV and being a closet authoritarian. But they cannot deny that he has won this historic victory because he has touched a chord with a people exhausted by years of misrule. You can only bribe the voters for so long before the squalor becomes too much to bear.
Tim Stanley: Muhammadu Buhar won Nigeria vote on campaign against corruption. He's an ex-dictator, but there's reason for optimism .
He says Jonathan administration failed to address corruption, poverty and rise of Boko Haram. Buhar may be tonic to years of misrule .