EARLIER this year more than 600,000 Mexicans signed a draft anti-corruption bill drawn up by civic groups, thus forcing the country’s Congress to debate it. Popularly known as the “3-out-of-3 law”, the bill would require public officials to publish declarations of assets, taxes paid and possible conflicts of interest. On April 29th, the last day of the parliamentary session, the Senate failed to approve it and an equally important measure to grant independence to a new anti-corruption prosecutor, mainly because of the opposition of the Institutional Revolutionary Party of President Enrique Peña Nieto. Unless Congress calls an extraordinary session and the laws are passed by May 28th, Mr Peña’s vaunted new National Anti-corruption System, enshrined in a constitutional amendment last year, will become a dead letter.

The push for the 3-out-of-3 law is an example of an unprecedented popular mobilisation against corruption in Latin America. This has gone furthest in Brazil, where millions have taken to the streets to demand the impeachment of Dilma Rousseff, the president, and also to back a judicial crusade against graft at Petrobras, the state-controlled oil company, which has seen business leaders jailed and powerful politicians accused.

But it goes wider. In Guatemala street protests and the work of a UN-backed investigative commission helped to topple a president over corruption allegations last year. Protests in Honduras forced the government to accept a similar, though weaker, commission. In Chile, a party-financing scandal prompted laws against conflicts of interest. In Argentina, following a change of government, prosecutors and judges are closing in on Cristina Fernández de Kirchner, the previous president, and her associates.

Corruption has long been endemic in Latin America. Voters have tolerated politicians who “steal but get things done” (an epithet first applied to a populist governor of São Paulo in the 1940s). In highly unequal societies with rudimentary states, the poor were grateful to the few politicians who helped them. The commodity boom of the 2000s brought wealth to governments; some of that was stolen. But overall there is no evidence that corruption has got worse: polls report that slightly fewer respondents say they have had to pay bribes.

Several factors are behind the mounting intolerance of corruption. There is a bigger middle class, which is demanding accountability and wants tax revenues spent on better public services. Social media have made it easier for individual citizens to mobilise. And there has been a slow maturing of civil society.

Perhaps the least remarked development has been what Kevin Casas-Zamora, a former vice-president of Costa Rica now at the Inter-American Dialogue, a think-tank in Washington, calls “the patient building of a new normative edifice” against corruption. Many countries have adopted international conventions against bribery and in favour of open government. These have been complemented by national laws, on freedom of information, increasing the penalties for corruption and, in Brazil under Ms Rousseff, empowering investigators by allowing plea-bargaining. During 30 years of democracy, many of Brazil’s judges and prosecutors have become more independent and more professional.

That is not so everywhere. In the short term, the corruption scandals are undermining faith in democratic politics. There is a risk that anger will be exploited by populist leaders. Hugo Chávez came to power in Venezuela by posing as a crusader against corruption. In office he did his best to increase it, by curtailing the independence of the judiciary, media freedom and accountable government. Some Latin Americans still turn a blind eye to dishonesty: a poll in Lima in 2014 found that half of voters believed that the victor in a mayoral election would steal but get things done.

It is vital that the current mobilisations against corruption translate into more effective laws and stronger institutions. Deltan Dallagnol, a young Harvard-trained prosecutor who heads a task-force investigating the Petrobras scandal, told La Nación, an Argentine newspaper, that the object is “to build citizenship, especially among lower-income people, so that they understand that the money siphoned off by corruption affects the attention that the state gives to their needs.”

That was well said. Many Mexicans get the point. By blocking action against corruption, Mr Peña not only looks like a man whose party has something to hide. He is also putting himself on the wrong side of Latin American history.