RIO DE JANEIRO — If there was a unifying figure in Brazil these past five years, as the economy flailed, violent crime soared and polarization deepened, it was Sérgio Moro. As the most prominent judge overseeing the vast corruption probe that upturned the country’s political order, he was the steely and resolute protagonist of the saga, crusading for a better Brazil, where crimes would go punished no matter who committed them.

Then President Jair Bolsonaro, the right-wing populist who made the fight against corruption a centerpiece of his campaign, appointed Moro his minister of justice — and said he’d nominate him for the Supreme Court, should an opening arise.

But now, after the publication of alleged private chats with prosecutors in the probe, Moro is in the uncomfortable position he’d put so many others through: At the center of an ethics scandal. The messages published by the Intercept Brasil over the past week appeared to show the judge advising federal prosecutors on how to try their cases against the country’s political elite, both in his courtroom and in the press.

The chasm between Moro’s public persona and his alleged private messages has stunned Brazil, dominating the news for days. Analysts say they could come to tarnish the broader corruption investigation, known as Operação Lava Jato, or Operation Car Wash, which has yielded 400 prosecutions in Brazil so far, and roiled the continent beyond.

“These revelations risk generating the perception that the entire operation is flawed,” said Oliver Stuenkel, an assistant professor of international relations at Getúlio Vargas Foundation in São Paulo. “That’s the risk, and it remains to be seen how they can defend themselves . . . To what extent will these new scandals push Lava Jato to the margins?”

The Justice Ministry did not respond to a request for comment.

Moro has denied any wrongdoing. He has said he was a victim of hackers and has questioned the authenticity of the messages. He has called for them to be submitted to an independent authority.

“As to the nature of my communications, I’m absolutely at ease,” he told the news outlet Estadão last week.

But supporters of imprisoned former president Luiz Inácio Lula da Silva have seized on the alleged leaks as evidence that the case against the leftist leader was rigged, and his sentencing should be overturned.

Lula was leading in presidential election polls in 2017 when Moro sentenced him to nine years in prison for corruption and money laundering. He was forced out of the race, paving the way for Bolsonaro to win the presidency.

To some, Bolsonaro’s appointment of Moro as his justice minister was evidence that he took corruption seriously. It struck others as unseemly.

Now the alleged leaks have left Moro exposed to accusations that he’d always been more interested in politics than scrubbing Brazil of corruption. The Brazilian Bar Association has called for his removal as justice minister, saying the “gravity of the facts cannot be disregarded.” The conservative Estadão, one of the country’s major news organizations, has also called on him to step down. His approval rating has dropped 10 points to 50 percent, according to Atlas Político, a political analysis service.

Moro has said he isn’t planning on resigning. He told Estadão he was a “victim of a criminal attack by hackers.” The Intercept, which claims its has more chats that it hasn’t yet published, has not disclosed the source of the alleged conversations.

On Friday, Moro said his actions were only evidence of “carelessness.”

“Carelessness” is not a word anyone would have used to describe Moro. He was the cerebral tactician, taciturn and intense, who’d studied Italy’s “Clean Hands” corruption investigation exhaustively to understand how it had successfully prosecuted the country’s political titans.

Once just another judge in the southern city of Curitiba, he gained broader attention in 2014 when he started hearing cases that would unspool the Lava Jato scandal. It was a classic kickback scheme, with state oil company Petrobras at its center, but of epic proportion.

As the charges piled up, and politicians and executives were hauled before his court, Moro became a celebrity. His presence at a supermarket was announced on a loudspeaker. Shirts were sold with his face on them. During demonstrations in support of Bolsonaro, a giant inflatable Superman appeared in Brasilia with Moro’s image superimposed on its face.

Lucas de Aragão, director of a political risk company in Brasilia, said Moro and others in the Lava Jato case developed a nearly “messianic” air.

“A couple of years ago, this would have been unbearable to think,” he said. “They were almost untouchable.”

But that has changed. When Moro accepted Bolsonaro’s appointment, he descended from a perch that had allowed him to float above the squabbles of politics to a position that was at the center of it.

Now as a prominent member of the Bolsonaro administration, he’s increasingly viewed as an “everyday politician,” said Creomar De Souza, a political scientist at the Catholic University of Brasilia.

“Every day, he is less a judge,” De Souza said.

In a country that’s as polarized as the United States, analysts said, it’s unclear whether the alleged leaks will sway public opinion further than they already have, unless there are worse leaks to come. The people who supported Bolsonaro will likely continue to support Moro. And among people who supported da Silva, this has only reinforced the belief that the investigations were politically driven.

“It’s a very polarized country,” said Stuenkel. “And to many, he’ll remain that hero.”