A man walks past masks during a protest by non-governmental organization Rio de Paz against political corruption scandals in Brasilia, Brazil, on May 23, 2017.Paulo Whitaker / Reuters

The good news is that much of the world is fed up with corruption. The bad news is that the way many are fighting corruption is ineffective. Too often, the remedy centers on finding and empowering an honest leader who promises to stamp out the problem. Worldwide, candidates for elected offices are running on highly personalized anti-corruption platforms, offering themselves as the solution. What countries really need, though, are smart laws that reduce the incentives and opportunities for corruption. They also need strong institutions that enforce those laws and deprive corrupt officials, and their private-sector accomplices, of impunity in their efforts to get rich at the public’s expense.

But growing global impatience with corruption is visible in the proliferation of anti-corruption fighters as political candidates. Protests against corruption are massive and frequent all over the world—India, Mexico, Bulgaria, Russia, and Thailand are just some of the many countries where they’ve erupted. Citizens there and elsewhere no longer believe that corruption is inevitable or that it is futile to try to fight it.

The impact of some of these popular protests has been surprising. The presidents of Guatemala and South Korea, for example, have been deposed and imprisoned. In Brazil, huge marches created the conditions for President Dilma Rousseff’s impeachment.

It’s gratifying to see corrupt leaders removed. But it does not follow that an honest political leader is the best antidote to corruption.

Societies that bet on an honest leader to solve their problems almost always lose out. Such leaders may turn out to have integrity, or they may not. Silvio Berlusconi, Vladimir Putin, and Hugo Chávez all came to power promising to stamp out corruption. And we know how that turned out.

Too often, the fight against corruption serves as a mechanism of political repression. The world’s autocrats exploit popular intolerance of venal politicians to eliminate their rivals. Vladimir Putin often accuses those who grow too influential of being corrupt and throws them in jail. Mikhail Khodorkovsky, once Russia's richest man, spent 10 years in a Siberian jail for tax evasion and theft. He was also actively funding anti-Putin politicians and their parties.

Since Xi Jinping assumed the Chinese presidency in 2012, more than one million officials have been “punished,” in the government’s words, for corruption. Some have been sentenced to death. In an anti-corruption purge, Saudi Prince Mohammed bin Salman recently arrested hundreds of prominent Saudis, including one of the richest men in the world, Prince Al-Waleed bin Talal. (In an ironic twist, one of the princes reportedly bought his release for $1 billion.) The governments of Cuba, Iran, and Venezuela regularly use accusations of corruption to imprison their opponents. No doubt there are genuinely corrupt individuals among those imprisoned by dictators. But the real reasons for these arrests surely have more to do with politics than with alleged dishonesty.

The fight against corruption does not have to be corrupt, however. In Argentina, Chile, Colombia, Peru, and Uruguay, for example, the Inter-American Development Bank (IADB) is supporting “public innovation laboratories” that experiment with new methods of monitoring and controlling government conduct. In Brazil, a group of data-analysis experts has used artificial intelligence techniques to monitor public officials. They focused narrowly on limiting fraud among members of congress seeking reimbursements for their travel and food expenses; after getting crowdfunding for the startup costs, they created Rosie, an Artificial Intelligence robot that analyzes the reimbursement requests of lawmakers and calculates the probability that they are justified. To no one's surprise, Rosie found that the deputies often cheated. The team gave Rosie her own Twitter account, and her followers are instantly notified if a member of congress tries to charge the government for expenses that have nothing to do with his or her work.

Rosie is just one small example showing the positive trends and new possibilities in the fight against corruption—it reveals the power of a well-organized civil society combined with technological innovation and information transparency in the public sector.

Indeed, it may seem too small an example in a country rife with corruption. It is easy to dismiss Rosie as a marginal effort that doesn’t really make a dent in large-scale graft. Case in point: While some deputies charged their personal expenses to the state, over the course of 15 years the Brazilian construction company Odebrecht paid $800 million dollars in bribes throughout the hemisphere and received benefits of $3.3 billion dollars from this scheme. Yet even here, there has been progress. Marcelo Odebrecht, the head of the company, has been sentenced to 19 years in prison. And members of Brazil’s congress might at least have to think harder before abusing their expense reimbursements. Rosie is watching.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.