ANYONE who has received a Nigerian scam e-mail—offering to share vast wealth in exchange for just a teensy bit of advance capital—will instantly grasp how rife corruption is in Africa's most populous and entrepreneurial country. This is true of politics as well as commerce. Cheating has become so brazen that few Nigerians expect fair elections. Politicians have for years larded voter lists with the names of foreign musicians, including deceased ones like Marvin Gaye, and have stuffed ballot boxes with abandon.

At parliamentary elections on April 9th, allegations of rigging were once again in the air. Violence also flared up. And the late delivery of ballot papers, which were securely printed abroad, delayed the voting by a week. Nonetheless, the poll marked the first credible election in Nigeria since the end of military rule 12 years ago (see article).

What made it different is that officials fought back hard for the first time. They introduced a new voting system that severely limits fraud, using a clever mix of high-tech and low-tech. All 73.5m voters were fingerprinted and screened to stop duplication. Most polling booths opened for only an hour to prevent multiple voting. Electoral officials tallied the results in front of the voters. Independent monitors collected the numbers instantaneously using mobile phones in an exercise called “crowd tabulation”.

The process has been expensive: the government has set a record for public spending on elections of $580m. Western donors argued at first that the system was too complex for a developing country to handle. They were wrong.

The credit goes mostly to two men. The first is President Goodluck Jonathan, who is himself standing for re-election on April 16th. He may thus benefit personally from the reforms, but he acted against the interests of his party, which had perfected the dark art of rigging. The second is Attahiru Jega, head of the official election commission, who designed a voting system that angered many powerful lobbies. Together they have given new hope to the many Nigerians who are embarrassed that their vibrant country, often ranked as the most optimistic in the world, has become a byword for swindling and fraud.

More has to change before Nigeria's political leaders can claim full legitimacy. The elections may be more transparent, but governing still takes place largely behind closed doors. The legislature remains too weak. The Official Secrets Act, which makes it illegal to publish government data independently, needs reform. So do the courts, which are suspected of bias and corruption. Legal challenges after previous elections have failed to produce a single conviction for electoral fraud.

Fit for export

Better elections should in the end help resolve Nigeria's existential question—whether this wildly diverse country of 150m people from 250 ethnic groups created by British colonial masters can work. But ambitious talk of taking over regional leadership is premature. Nigeria should first try to close the democratic gap with South Africa, the continent's top dog, as well as improve its scam-ridden economy.

The best way for Nigeria to show leadership is to help its neighbours to stop rigging their polls. Not all have the right staff or can afford high-tech answers. But as countries from Côte d'Ivoire to Kenya have found, bad or contested elections can be the costliest mistakes of all.