I T WAS BRAZIL’S most controversial trial since Tiradentes (“Toothpuller”) was hanged in 1792 for plotting in Minas Gerais against Portuguese colonial rule. In July 2017 Sergio Moro, a crusading young judge, convicted Luiz Inácio Lula da Silva, a popular former president, of corruption, sentencing him to nine years in jail for receiving a beachside apartment from a construction magnate who obtained padded government contracts. This week that conviction was called into question after the Intercept, an investigative news website, published hacked messages from Mr Moro and Deltan Dallagnol, the chief prosecutor in the case, which appear to throw doubt on the judge’s impartiality and the integrity of the prosecution.

For several reasons, Lula’s situation may not change much. But the sprawling anti-corruption investigation known as Lava Jato (Car Wash) may have suffered a fatal blow. The Intercept claims to have “an enormous trove” of hacked messages, many of them on Telegram, an encrypted communications app. In some ways, the material published so far amounts to less than is claimed.

Lula’s conviction, and his jailing after a failed appeal, barred him from running in last year’s presidential election. He was leading in the opinion polls but was far from certain to win. Jair Bolsonaro, the populist eventual victor, profited from widespread hatred of Lula’s Workers’ Party (PT ) because of its catastrophic economic mismanagement and involvement in a vast web of corruption. Nevertheless, on Telegram the prosecutors expressed alarm at the prospect of Lula giving a press interview from jail. As much as political partisanship, that looks like self-preservation, since they had reason to fear the revenge of the PT should it return to power.

More serious, perhaps, is the revelation that four days before unveiling his case against Lula, Mr Dallagnol doubted its solidity and rejoiced when his team found an old press cutting about the flat. The case relied heavily on the testimony, derived from a plea bargain, of the jailed construction magnate. Lula insists he never owned or occupied the flat.

Most damaging are the many messages Mr Moro exchanged with Mr Dallagnol, in which he appeared both to coach and to chide him. The two seemed to work closely together. Under Brazil’s constitution of 1988, judges are supposed to be neutral arbiters. In practice, lawyers say, judges often exchange information with prosecutors. That is against both the law and the code of judicial ethics. In such an important case, Mr Moro should have known better than to break the rules.

Neither Mr Moro nor Mr Dallagnol has denied the authenticity of the messages, though they complain that they were obtained illegally. That means they might not be admissible as evidence in Lula’s lawyers’ attempt to quash his sentence. Even if they succeed, the bigger picture still looks bad for Lula. In February he was convicted, on stronger evidence, of receiving a country house from construction firms; he faces another six cases. As for Mr Moro, he had already aroused suspicion over his motives when he became Mr Bolsonaro’s justice minister. He is a hero to many Brazilians. But his position now looks untenable.

Mr Moro and Mr Dallagnol were central protagonists of Lava Jato, in which some 200 businessmen, officials and politicians have been convicted. The investigation has plenty of enemies on the right as well as the left. Although many of its critics are self-interested, others worry about the prosecutors’ use of preventive detention and plea bargaining. For all that, Lava Jato has broken new ground in holding the powerful to account and revealing the unbearable scale of corruption in Brazil. Its excesses should be corrected. But its enemies will now feel emboldened to ensure that further investigations of politicians die.