AFRICAN leaders dying in office is often a sign of rottenness: years of misrule capped only by a hushed-up death. But on July 24th, within hours of the sudden end from cancer of Ghana’s president, John Atta Mills, his deputy, John Mahama, was sworn in with impressive constitutional calmness to replace him.

The most unusual sight was the square outside the country’s parliament filled with 48 large ambulances. This did not indicate the sickliness of Ghana’s political class, but rather signalled business as usual after a swift handover. The newly imported vehicles, destined for one of Africa’s better health services, apparently had nowhere else to park. Parliamentarians thronging the corridors, who relish calling each other “wicked rascals” and worse, praised the manner of their new leader’s ascent. Ghana’s democracy, hailed by Barack Obama as a “model for Africa”, evidently weathered the transfer of power just fine.

The same may not be said of Mr Atta Mills’s party. In power since 2008, the National Democratic Congress had already been struggling to win re-election in a poll scheduled for December. Some voters are disgruntled because the oil boom that started a few years ago has failed so far to create many jobs. Though the economy grew by more than 14% last year and may surpass 10% this year, people dislike the speeding pace of inflation, now at 9%.

Thus encouraged, Nana Akufo-Addo, the opposition’s presidential candidate, is touring the countryside and drawing large crowds with promises of an industrial revolution. He got the most votes in the 2008 election, but not the 50% required to win in the first round. He lost to Mr Atta Mills by only 41,000 votes in the second, a result he magnanimously accepted without grumbling or asking for a recount.

Who will stand against him this time is now unclear. Mr Mahama, the new president, may seem the obvious candidate. But a feud in the ruling party, festering for years, may well get worse now that its proven election winner is gone. A run by Nana Konadu Rawlings, wife of a long-serving former president and military leader, Jerry Rawlings, may split the vote. An opposition victory in December would be in keeping with Ghana’s recent democratic history. On two occasions in the past 20 years, power has peacefully changed hands. Elections have been run by a genuinely independent commission and deemed free and fair. The army is out of politics. Judges often rule against the government. The handling of the first death of a leader in office has confirmed the stability of Ghana’s institutions. That is not always obvious. Ghanaian politicians are an extremely lively bunch; some pundits say that the absence of primogeniture in tribal clans results in a tradition of fierce competition for power. Party leaders make wild accusations against each other, usually involving corruption. The opposition says the government recently siphoned off $3 billion. But while bribery is common, so is hyperbole among the politicians. “Corruption is an easy drum to beat,” admits Isaac Asiamah, an opposition MP. Yet politics in Ghana is becoming sophisticated. Campaigners ask voters to send donations by textmessage. Diaspora groups play an active part. Accra, the capital, has more than 100 radio stations, many with political call-in shows for Ghana’s astute citizens. More than half a dozen daily newspapers publish extensive news reports. A freedom of information law is on its way. Some still fear that heated language may stir sporadic election-day violence. But local mediation committees have been set up to quell tensions.

The big question on everyone’s mind is who will benefit most from offshore oil that was found in 2007 and has flowed since 2010. After two good decades, will the state turn into a feeding trough for the powerful or will the new wealth trickle down and be used to pay for better schools and roads?

There is much talk of an oil curse in Ghana, but that seems premature. The lack of new jobs is unsurprising; offshore fields require expensive machinery rather than manual labour. Rising inflation and a dipping currency are in part the result of the government spending borrowed funds; China has offered a credit facility of $13 billion while oil revenues so far amount to less than $500m, since production is taking off more slowly than expected.

So far politics has not been poisoned by oil. With foreign advice, the government drew up strict revenue-management rules. If it can implement them, which will not be easy, Ghana looks set to continue on its upward trajectory, even if some cash ends up in the pockets of politicians.

Overall standards of living have risen fast. Ghana is now classed a lower-middle-income country. A hopeful member of Britain’s government, which strongly backs its former possession, recently declared, “Ghana’s boom proves aid can really work.” The country is getting close to meeting most of the UN’s Millennium Development Goals. Many of its people have indeed escaped misery.