RIO DE JANEIRO — President Jair Bolsonaro’s cellphones were among hundreds targeted by hackers this year, he said Thursday, as part of an elaborate scheme that has roiled the political establishment and called into question the fairness of high-profile corruption prosecutions.

The revelation came days after law enforcement officials took four people into custody as part of their investigation into the hacking of confidential material stored on the cellphones of Brazilian cabinet members, prosecutors and lawmakers.

Mr. Bolsonaro called the hacking “a serious attack against Brazil and its institutions,” but said he personally had little to fear. “I never handled sensitive or national security matters over a cellphone,” he said.

On Thursday, Brazilian newspapers reported that one of the suspects, Walter Delgatti Neto, told investigators that he had leaked correspondence between prosecutors and a prominent judge to The Intercept, an online news site, which published several articles based on the material.