WHEN Dilma Rousseff, Brazil’s president, delivered a televised speech to mark International Women’s Day on March 8th, it was almost impossible to hear her in some districts. Thousands of middle-class Brazilians drowned her out by banging pots and pans, a traditional way to show dissent in neighbouring countries. Brazil’s panelaço is new.

Brazilians have plenty to grumble about, from a stagnant economy to fiscal austerity, but the pot-bangers’ main grievance is the scandal at Petrobras, a state-controlled oil giant. On March 6th a Supreme Court judge agreed to open investigations into 34 sitting politicians, including the speakers of both houses of Congress, whom a prosecutor suspects of participating in a multi-billion-dollar bribery scandal. All but two are allied with Ms Rousseff’s ruling coalition. She was not on the list, but she was Petrobras’s chairman in the mid-2000s, when much of the alleged corruption took place. On March 15th Brazilians plan rallies across the country to demand her impeachment.

Brazil’s disquiet is not unique in Latin America. In Mexico the disappearance of 43 students in the southern state of Guerrero, and their apparent murder by drug-traffickers in league with police, have sparked protests since September. Revelations of a housing deal between the wife of the president, Enrique Peña Nieto, and a company linked to a businessman who won government contracts added to the fury about corruption; the finance minister has been similarly embarrassed.

Allegations that Argentina’s president, Cristina Fernández de Kirchner, and her late husband, Néstor Kirchner, who preceded her as president, enriched themselves during a dozen years in power, have brought out the pot-bangers, too. She denies wrongdoing. The son of Chile’s president, Michelle Bachelet, recently quit as head of a state charity over accusations of influence peddling. Her popularity has dropped to its lowest level since she returned to power a year ago.

Waxing and waning: Brazil's economic woes, in charts Resistance to corruption in Latin America has a long and largely futile history. Antonio de Ulloa, a naval captain, tried and failed in the 1750s to eradicate fraud at a mercury mine in the Andean town of Huancavelica. Corrupt leaders have been ousted in the democratic era without much effect on corruption itself. Hugo Chávez’s fulminations against it in Venezuela helped his rise to power; under his “Bolivarian” regime it worsened. The jailing of Alberto Fujimori, under whom the Peruvian state became a criminal enterprise, did not purge the country. His system has been dismantled, but “scale models” of it persist at regional level, says José Ugaz, a Peruvian lawyer who is chairman of Transparency International, a Berlin-based NGO. Yet in today’s scandals, and the indignation they have aroused, lie hopeful signs. The unrelenting pursuit of executives and politicians responsible for the Petrobras scandal (the petrolão) shows that Brazil’s judicial institutions are functioning as they should. In Mexico Congress is pushing through anti-corruption reforms. There are promising experiments in Central America. Latin America’s young democracies may be starting to get to grips with one of their worst and most enduring problems. The viceroys of the colonial era set the pattern. They centralised power and bought the loyalty of local interest groups. “In Peru abuse starts with those who ought to correct it,” wrote Ulloa and a collaborator in 1749. Caudillos, dictators and elected presidents continued the tradition of personalising power. Venezuela’s chavismo and the kirchnerismo of Ms Fernández are among today’s manifestations.

This is a damaging pedigree. Though Latin America is a middle-income region, two-thirds of its countries come in the bottom half of Transparency International’s “corruption perceptions index”. In South America only Chile and Uruguay stand out from the dismal regional norm (see map), perhaps partly because in colonial times they were backwaters; Costa Rica is the Central American exception. Even more corrupt countries have islands of integrity: Mr Ugaz points to Peru’s central bank and tax-collection authority.

Anatomy of vice

Graft is hydra-headed and has multiple causes. Presidents who plunder make the biggest headlines. But presidential misbehaviour can take the milder forms of conflict of interest (as, apparently, in the case of those Mexican houses) or nepotism. Such temptations extend to anyone in authority, especially if, as is often the case, he or she is ill trained and badly paid. A fifth of Latin Americans report having paid a bribe over the course of a year, most often to the police. Colombia’s anti-corruption tsar, Camilo Enciso, says that no sector of the country is untouched by corruption.

The costs are hard to quantify, but surely immense. In 2010 FIESP, the industry federation of São Paulo state, estimated that corruption cost 1.4-2.3% of GDP every year. In Peru stolen public money adds up to 2% of GDP, says Ana Jara, the prime minister. Almost a fifth of businessmen think corruption is the main obstacle to doing business in Mexico, says the World Economic Forum. Paying bribes for basic services such as water supply makes the poor even poorer. In Mexico it eats up a quarter of their income, according to one estimate. Richer folk pay fixers, such as Brazil’s despachantes and Argentina’s gestores, to get things done. Popular anger at corrupt officialdom can become hostility toward democracy itself.

Many Latin America watchers assumed that democratisation and the market reforms that began in the 1980s would curb corruption. Instead, they provided new opportunities for it. Democracy gave rise to parties hungry for donations and politicians eager to reap the rewards of elected office. In Mexico, it brought an “out of control [corruption] booze-up”, wrote Luis Carlos Ugalde, a consultant, in Nexos, a magazine. In Brazil, where entire states count as single constituencies, campaigns are ruinously expensive. Candidates spent 4.1 billion reais ($1.3 billion) in last year’s state and national elections, not counting the race for the presidency. Campaign-finance laws are riddled with loopholes. In Chile donors are meant to give money through an agency that hides their identities from the candidate. But within the country’s small elite, such secrets leak out. Surveys find that political parties are Latin America’s least trusted institutions.

Economic reform also incited graft. Proceeds from the privatisation of state companies enriched ruling cliques in Argentina and paid for social spending aimed at supporters of ruling parties in Peru and Mexico. The commodities boom of the early 2000s brought more money and more ways of pilfering it. The petrolão would not have been so huge without the rise in oil prices of the past 15 years. Even more destructive was an upsurge in drug-trafficking from the 1980s, which implanted the idea that everyone, from policemen and judges to ministers and presidents, “has a price”, says Mr Enciso. Torrents of new money, from both legitimate and illicit sources, greatly increased what Mr Ugaz calls “grand corruption”.

Many Latin Americans have long shrugged their shoulders, which has made corruption harder to stamp out. Rouba, mas faz (he steals but he acts), say Brazilians indulgently of politicians who leaven their greed with efficiency. Campaigning to be mayor of San Blas, a town on Mexico’s Pacific coast, Hilario Ramírez Villanueva admitted at a rally last year that in an earlier term in office “I did steal, but only a little.” Besides, he added, “I gave back with the other hand to the poor.” He was elected, and celebrated by throwing banknotes to supporters.

This is discouraging. But there are signs that corruption’s hold, tenacious as it is, may be loosening. Today’s anti-graft efforts, in some countries at least, are not just a backlash against the scandals of the moment; they are the work of institutions that are starting to mature, in some cases because of popular pressure. This is true in the region’s two biggest economies, Brazil and Mexico, but not only there.

Brazil’s constitution, enacted in 1988, conferred independence on the public prosecutor’s office and the judiciary. But they have exercised it only in the past decade or so. Geraldo Brindeiro, the chief prosecutor during the presidency of Fernando Henrique Cardoso from 1995 to 2003, was mocked as “mothballer-general of the republic” for his apparent reluctance to pursue corrupt officials.

Brazil’s feisty media have lowered the tolerance for corruption among ordinary folk and the officials responsible for rooting it out. Time has brought a change of generations. Mr Brindeiro’s successor was the first to be chosen by prosecutors themselves. The next went on to denounce the Workers’ Party, to which Ms Rousseff belongs, in Brazil’s previous epic scandal, the mensalão, which uncovered payments to congressmen in exchange for pro-government votes. Rodrigo Janot, the prosecutor in charge of the petrolão, and Sérgio Moro, the judge who presides over the case at the federal court in Curitiba, belong to a cohort that sees corruption as not just a moral failing but a cause of tangible damage, says Luiz Felipe d’Avila of the Centre for Public Leadership, a think-tank. “Corruption kills,” says Mr Janot.

Waking up the watchdogs

Better Brazilian judges and prosecutors are part of an institutional upgrade—disconnected improvements brought about by legislation and new technology. It is still partial at best, but should make a difference. The “clean companies act”, which entered into force in January 2014, extends sanctions from bribe takers to bribe givers. Lawyers say it has prompted companies to take compliance seriously. Cash payments to the poor through the Bolsa Família programme—which are made electronically—cannot easily be stolen or directed to supporters of a local potentate. São Paulo state’s transport department has made it possible to renew a driver’s licence online, cutting out bribe-taking bureaucrats. It plans to install cameras in examiners’ cars.

The monopoly of power held by Mexico’s Institutional Revolutionary Party (PRI), to which Mr Peña belongs, was broken only in 2000. Mexico’s press, with some exceptions, is less obstreperous than Brazil’s, in part because much of it relies on government advertising. But pressure for reform has increased. The Guerrero murders and revelations about house purchases triggered an outpouring of anger against the president and the political elite. Mr Peña’s ambitious programme of reforms to energy and other sectors will fail if their integrity is not protected.

The elite has begun to respond. In late February Mexico’s lower house approved a constitutional change to create a “national anti-corruption system”. Rather than entrust responsibility to a single commission, as some Latin American countries have done, Mexico aims to share it out among different organs of government as well as the judiciary. “We favour checks and balances, institutions rather than heroes,” says Mauricio Merino, lead co-ordinator of the Accountability Network, a grouping of NGOs that pushed for the legislation.

Until secondary legislation is passed to regulate conflicts of interest and specify the powers of the new bodies, it is impossible to say how well the new system will work, says Mr Merino. Already, there is opposition from state governors, especially those within the PRI. The reforms could be as important as those that ushered in democracy, but it “will take at least a generation to change habits,” he says.

Other countries are taking encouraging steps. Honduras’s president, Juan Orlando Hernández, has signed an agreement with NGOs to act as “parallel auditors” in education, health, and other government services. They persuaded him to appoint an education minister, who has slashed the payment of salaries to “phantom teachers”. Chile will soon close loopholes in its campaign-finance legislation. In Peru Mr Ugaz sees hope in activism among students, who protested successfully against the appointment of unqualified candidates to the constitutional court and the ombudsman’s office. This was “a reaction of youth against a corrupt class,” he says.

Such gains are fragile, and in some countries absent. October’s presidential election in Argentina is unlikely to bring improvement. Where governments crimp press freedom, for example in Ecuador and Venezuela, corruption is likely to flourish. Brazil needs electoral reform to upgrade the quality of its politicians. Even the progress in the judiciary is not secure. The prosecution in the petrolão is impressive, says Mr Moro, the judge, “but institutional reaction must be the rule. And it isn’t yet.”

However, as Latin America grows richer, more educated and more equal, citizens will press harder for honest politicians and officials. At long last democracy is working for them. It is “thanks to political plurality that, despite everything, we are taking steps in the right direction,” says Mr Merino. That bodes well for Mexico, and its neighbours.