BRASÍLIA, Brazil — President Donald Trump made his demands to Brazil very clear: Drop the charges against former President Jair Bolsonaro of attempting a coup.

To show he was serious, he hit Brazil with punishing tariffs, launched a trade investigation and imposed some of the most severe sanctions at his disposal against the Supreme Court justice overseeing the case.

Brazil responded Thursday by convicting Bolsonaro anyway, sentencing him to more than 27 years in prison for overseeing a failed plot to stay in power after losing the 2022 elections.

Defiance has defined Brazil’s response to Trump since he began trying to bully the country. So far, it hasn’t resulted in disaster.

President Luiz Inácio Lula da Silva has watched his poll numbers rise as he has denounced his American counterpart. Alexandre de Moraes, the Supreme Court justice targeted by sanctions, has been fiercely backed by Brazil’s democratic institutions. And last month, when Trump’s 50% tariffs on Brazilian exports took effect, Brazil said its global exports actually rose 4% because of increased purchases by China.

“Does anyone believe that a tweet from a foreign government official will change a ruling in the Supreme Court?” Justice Flávio Dino said as he cast his vote this past week to convict Bolsonaro.

In response, Secretary of State Marco Rubio tweeted: “The United States will respond accordingly to this witch hunt.”

How much further Washington is willing to go in its fight with Brazil is unclear. The U.S. government has used some of its most powerful tools. Its latest actions focused mostly on revoking the visas of some Brazilian officials.

If the tariffs last — or even increase — it may eventually prove difficult to explain to American voters why they should pay more for beef, coffee and sugar to intervene in Bolsonaro’s case.

U.S. officials have said their problems with Brazil go beyond Bolsonaro. They accuse de Moraes of censoring free speech by ordering social networks to block accounts that often he alone decides threaten Brazil’s democracy.

His actions have indeed been harsh at times and lacked transparency, prompting criticism within Brazil, too. He and fellow justices have argued that the Brazilian right’s recent attacks on democracy — including a plot to assassinate de Moraes — have required a firm response.

Karoline Leavitt, the White House press secretary, was asked this past week about de Moraes’ approach to the internet. Her response, delivered as the judge was voting to convict Bolsonaro, raised eyebrows: “The president is unafraid to use the economic might, the military might of the United States of America to protect free speech around the world.”

Brazil’s government condemned the statement, and Lula later told a radio station, “The U.S. needs to know it’s not dealing with a banana republic.”

Trump did not seem to be revving for a fight when asked Thursday if he would respond to Bolsonaro’s conviction with more sanctions.

“It’s very much like they tried to do with me, but they didn’t get away with it,” he said.

He did not mention any retaliation.