In two days, he would publish another story alleging that the judge who’d overseen Lula’s case, Sérgio Moro, a national hero in Brazil for his role taking on corruption, had colluded with prosecutors to convict him.

“This material is going to come out,” he said. “Even if they put me in prison.”

The prospect felt real enough. Greenwald, the polarizing American journalist who came to prominence reporting on the U.S. government surveillance programs exposed by Edward Snowden, had promised months of stories — a steady drip of leaks that could imperil the Bolsonaro agenda. Some members of Brazil's National Congress had called for his deportation. Others accused him of committing a crime. Death threats were rolling in.

Most recently, the federal police, commanded by Moro, now Bolsonaro’s justice minister, reportedly began investigating Greenwald’s finances in a probe that press advocates here see as an attempt to silence him.

The public threats against Greenwald represent an early test for Brazil under Bolsonaro, the right-wing former military officer who won the presidency last year with appeals to nationalism, homophobia and nostalgia for the country’s two-decade military dictatorship.

Will this government tolerate damaging reporting by a gay foreign journalist? Or will it move to silence him, confirming fears of Bolsonaro’s potential for authoritarianism?

“There are all of these lurking questions that have found a vehicle for expression in this story,” Greenwald said. “It’s more than just Sérgio Moro. It’s about what kind of government we’re going to have.”

Greenwald moved to Rio in 2005, after meeting the man who would become his husband while vacationing here. Over the next decade, as he covered American issues from afar, he built a Brazilian life. His husband, David Miranda, is a socialist member of Congress. They adopted two Brazilian children and opened a dog shelter. They now live in a cavernous house, built around a giant boulder, on a leafy street in a gated community near a mountain.

His divisive reporting and opinions have long attracted fans in the United States — and also critics, some of whom he has viciously attacked online: “You idiot” is a favorite epithet on Twitter.

It wasn’t until 2016, however, that he became a polarizing figure here, too. The impeachment of President Dilma Rousseff, Lula’s anointed successor, was cleaving the country along partisan lines. Greenwald started writing Portuguese-language columns critical of the proceedings. They found a massive audience, convincing him there was room here for an investigative news site.

The Intercept Brasil, launched in August 2016 as a Portuguese-language offshoot of the online news organization Greenwald co-founded two years earlier, joined a media industry that would soon be strained by a divisive political campaign, the imprisoning of Lula and the ascent of Bolsonaro. The right-wing candidate made attacks on the mainstream media a pillar of his campaign.

“Bolsonaro uses Trump as a role model,” said Rosental Calmon Alves, director of the Knight Center for Journalism in the Americas at the University of Texas at Austin. “Part of Trumpism is attacking the press and having the press as the enemy. Bolsonaro has tried to play by the same playbook.”

Bolsonaro supporters harassed and threatened fact-checkers, advocates for the press say. The Brazilian Association of Investigative Journalism counted nearly 62 instances of physical aggression against journalists in 2018 in a political context.

“The fact that we had to create a systematic survey of instances — a need that had not been perceived until then — shows that the last campaign was atypical,” said the organization’s executive manager, Marina Iemini Atoji.

When Bolsonaro won the election, Paris-based Reporters Without Borders called him “a serious threat to press freedom and ­democracy in Brazil.”

It was in this context, Greenwald says, that a person — he declined to say who — got in touch to offer information that would send tremors through the political order.

A central figure in the archive of materials he obtained was Moro, one of Brazil’s most popular people, seen by many as a crusader for public probity.

The Intercept’s first story, published in early June, challenged that narrative. It alleged that Moro had worked inappropriately with federal prosecutors to imprison Lula, the leader in presidential polls, clearing Bolsonaro’s path to the presidency. Moro has denied wrongdoing.

The reporting triggered responses that reflected the country’s divisions. While a majority disapproved of his alleged communications with prosecutors during the “Car Wash” investigation, polling has shown, most have continued to support him. And Greenwald, who has never hidden his disdain for Bolsonaro, found himself facing an accusation he’s heard before: that he’s less a journalist than an activist.

“He’s very clearly positioned in Brazil,” said Oliver Stuenkel, an assistant professor of international relations at the Getúlio Vargas Foundation in Sao Paulo. “A lot of people say he has an agenda and he’s not objective.”

Soon the story became as much about Greenwald — his sexuality, his marriage to a Brazilian man, his status as a foreigner — as about the allegations the Intercept was publishing.

Carlos Bolsonaro, the president’s son, fanned conspiracy theories and appeared to call Greenwald’s husband a girl. An online petition for the journalist’s deportation amassed nearly 100,000 signatures. Homophobic messages tore across social media. Moro said the Intercept was “allied” with “criminal hackers.”

Then this month, the website Antagonist, which has a reputation in Brazil as anti-Lula, reported that the federal police were investigating Greenwald’s finances. Officials have declined to confirm or deny an investigation.

“Our constitution is very hard in the defense of freedom of expression and the press,” said Leandro Demori, executive editor of the Intercept Brasil. “But are our institutions strong enough to protect the constitution? I don’t think so. I really don’t. We’re afraid.”

Greenwald is inclined to agree. He experienced threats and denunciations in the aftermath of the Snowden revelations. But this feels different, he said. It’s more personal.

“In Snowden, I was only the reporter,” Greenwald said. “In this case, there’s no identifiable source, so they’ve personally identified me, like I was the person who took the material.

“I’m a good target. I’m a foreigner. I’m gay. I’m married to a socialist politician.”

He looked outside for a moment, where it was all sun and foliage. He says Brazil is still “paradise.” But beyond the trees were concrete walls, now freshly fortified with coils of electrified barbed wire. These days he rarely ventures beyond its barrier, he said, for fear of assassination.

Still, he has no plans of leaving.