AS WELL as its five football World Cup victories and the world’s largest rainforest, Brazil has just acquired another unique distinction. It is the only country to have impeached two presidents in just 24 years. In the first case, that of Fernando Collor, who resigned in 1992 on the brink of being condemned for corruption, impeachment commanded near-universal support, and could be read as a sign of democratic vigour. In the case of Dilma Rousseff, ousted by the Senate by 61 votes to 20 on August 31st, judgments are far more mixed. Even some who did not sympathise with Ms Rousseff think her ousting sullies democracy. They worry that Brazil has devalued impeachment, turning it into a means to dump an unpopular ruler—and, in this case, replace her with her unequally unpopular vice-president, Michel Temer.

Some of the arguments Ms Rousseff deployed in two days of evidence before the Senate were mere propaganda. No, her impeachment was not a coup, of any description. It took place over nine months, in strict accordance with the constitution and supervised by the supreme court, a majority of whose members were nominated by Ms Rousseff or Luiz Inácio Lula da Silva, her predecessor and the founding leader of her left-wing Workers’ Party (PT).

The offence Ms Rousseff was accused of—using credits from public banks to swell the budget without the permission of Congress—is a “crime of responsibility” under Brazil’s impeachment law of 1950. But there the difficulties start. Her defenders are right that this charge was a relatively minor, technical matter. The lawyers who filed the impeachment petition hit upon it because there is no evidence that Ms Rousseff was personally corrupt. That is not true of Eduardo Cunha, the former Speaker of the lower house of congress. He accepted the petition, she plausibly claims, as an act of vengeance because she refused to help him evade expulsion over corruption allegations. It is troubling, too, that many of those who voted to oust her are accused of misdeeds. And Mr Temer, a 75-year-old political insider, hardly embodies the regeneration his country’s rotten politics need.

Yet that is not enough to turn the moral tables in Ms Rousseff’s favour: many of the “coup-plotters” had been for a decade allies (and several were ministers) of the president and her predecessor. Their corruption, if proved, is venal and personal. More sinister is that of the PT, which organised a vast kickback scheme centred on Petrobras as part of a “hegemonic project that involved growing control of parliament, of the judges and…of the media”, as Fernando Gabeira, a left-leaning former congressman, wrote in O Globo, a newspaper. Ms Rousseff chaired Petrobras’s board (in 2003-10) and then ruled the country while this scheme flourished. Her claim to know nothing of it, nor that her campaign guru in the election in 2014 was paid with bribe money, smacks of negligence.

On its own, the Petrobras scandal didn’t doom her. When Mr Cunha launched the impeachment last December, most political analysts expected it to fail. The subsequent stampede against the president owed everything to her own incompetence and to public opinion, which was enraged, too, by her catastrophic mishandling of the economy. Above all, she failed to build alliances in Congress, which need not always involve back-scratching. The crisis of governability in Brasília intolerably prolonged the economic slump, undermining some of the social progress made under Lula. It would have been resolved less divisively by Ms Rousseff resigning or by a fresh election. But she refused to step down, and an early election is constitutionally difficult.

So Brazil is where it is. And it offers some lessons. One is that Ms Rousseff has paid the ultimate price for her fiscal irresponsibility (which went far wider than those disputed credits). That ought to be a salutary warning to Latin America’s more spendthrift politicians. Second, Brazilians want to hold their governments to account. Mr Temer will lose all legitimacy if he yields to pressure from his friends to rein in the Petrobras investigation or helps Mr Cunha avoid justice.

The third lesson is that in Brazil, with its strong parliamentary tradition, no president can govern against Congress. When Ms Rousseff brandishes her 54m votes in the presidential election of 2014 as a defence, she forgets that they were for Mr Temer too, and that the senators have an equally valid democratic mandate. Brazil has thus offered a tutorial in constitutional theory to the likes of Nicolás Maduro, Venezuela’s dictatorial president. The legacy of a divisive impeachment is not all bad.