SAO PAULO, Brazil — Brazilian President Jair Bolsonaro’s cellphone was hacked as part of an operation that also targeted senior members of his government, Brazil’s Justice Ministry said Thursday. Four men have been arrested on suspicion of having broken into the cellphones of several cabinet ministers and hundreds of judges and prosecutors.

“They are wasting their time with me,” Bolsonaro told reporters Thursday. On Twitter, he called the hacks “a grave attack against Brazil and its institutions” that must be punished, and said he has never discussed sensitive or national security issues on his cellphone.

No information from Bolsonaro’s phone has appeared publicly, but the arrests widen a scandal that has challenged the ­president’s mandate as a self-proclaimed crusader against corruption.

In June, the Intercept news website released messages allegedly exchanged between prosecutors and Judge Sérgio Moro in the wide-ranging Operation Car Wash corruption scandal. The messages appeared to show Moro guiding prosecutors in their case against former Brazilian president Luiz Inácio Lula da Silva.

Lula was leading Bolsonaro in presidential-election opinion polls when he was jailed last year on corruption charges. Lula, who was Brazil’s president from 2003 to 2010, was convicted and is serving a 12-year sentence; he has said he is innocent.

The Car Wash investigation uncovered a scheme through which Brazilian construction companies bribed politicians to secure lucrative deals for government projects. More than 100 of the country’s top political and business leaders were implicated; scores have been convicted.

The scandal spread beyond Brazil, reaching officials from Mexico to Argentina; three former presidents of Peru have been accused.

Moro, who presided over many of the Brazilian cases, emerged as an anti-corruption hero.

Bolsonaro won the election and named Moro his justice minister. He has not confirmed the authenticity of the messages but says they do not show improper behavior.

One of the men arrested this week told police he had given Intercept co-founder Glenn Greenwald access to the messages, local papers reported. He said he gave Greenwald the messages anonymously and free of charge after they had been hacked.

Greenwald has declined to identify the source of the leaks.

The men who were arrested are accused of hacking the cellphones of Moro, the finance minister, Bolsonaro’s chief of staff and others. Police said they are tracing hundreds of thousands of dollars in suspicious financial interactions related to the hacks. 

The messages have called into question Moro’s once-sterling reputation as the impartial judge who presided over the Car Wash cases.

Indignation over the bribery scandal helped propel Bolsonaro to power last year. The former army captain vowed to crack down on corruption, with Moro the face of the effort.

But now, many Brazilians have soured on Moro. A poll conducted after the Intercept began publishing the alleged leaks found that 58 percent of Brazilians believed the exchanges to be “improper.”

Moro disagrees. In a session before the country’s Senate last month, he said he would be happy to step down if proof emerged that he acted illegally.

“I’m not attached to the job, in and of itself,” he said. “Show us everything. Let’s submit it to public scrutiny.”

The news that the president was hacked comes a day after Puerto Rico Gov. Ricardo Rosselló resigned amid widespread protests after messages between him and his staff were leaked to the public. 

In Brazil, the leaks have polarized the country. Some have called for Greenwald, a U.S. citizen who lives in Rio de Janeiro, to be deported. Others have called for Moro to step down.

The leaks also have sparked a discussion about whether journalists who divulge information obtained illegally by third parties should be protected from criminal persecution.  

Greenwald for his part defended the articles, tweeting that “evidence of Moro’s impropriety, perhaps obtained illegally, does not change or alter the fact that he acted in a corrupt fashion.”