Federal prosecutors in Brazil on Tuesday charged the American journalist Glenn Greenwald with cybercrimes for his role in bringing to light cellphone messages that have embarrassed prosecutors and tarnished the image of an anti-corruption task force.

In a criminal complaint made public on Tuesday, prosecutors in the capital, Brasília, accused Mr. Greenwald of being part of a “criminal organization” that hacked into the cellphones of several prosecutors and other public officials last year.

Mr. Greenwald, an ardent critic of Brazil’s far-right president, Jair Bolsonaro, is a deeply polarizing figure in Brazil, where his work is lionized by leftists and condemned as partisan and heavy-handed by officials in the Bolsonaro administration.

The news organization Mr. Greenwald co-founded, The Intercept Brasil, published articles last year based on the leaked cellphone messages that raised questions about the integrity and the motives of key members of Brazil’s justice system . . .