RIO DE JANEIRO — Brazil’s Supreme Court on Friday ordered former President Jair Bolsonaro to wear an ankle monitor, stay home during most hours and stay away from foreign embassies because it said he was a flight risk after lobbying President Donald Trump to intervene in his legal troubles.

The orders are a sharp escalation of Brazil’s sudden feud with Trump over the legal case against Bolsonaro, who could end up in prison this year on charges that he attempted a coup after losing the 2022 election. Trump has threatened 50% tariffs starting Aug. 1 on Brazilian goods, in part to pressure Brazilian authorities to end what he has called a “witch hunt” targeting Bolsonaro.

Brazilian President Luiz Inácio Lula da Silva has pushed back aggressively, saying that Brazil will not capitulate to a U.S. president whom he accuses of wanting to be an “emperor.”

On Thursday night, Trump posted online that the charges against Bolsonaro should be dropped. On Friday morning, Brazilian federal police raided Bolsonaro’s home and office. Alexandre de Moraes, a Brazilian Supreme Court justice who has overseen investigations into Bolsonaro, said he had ordered Bolsonaro to remain under house arrest during nights and weekends and barred him from contact with foreign officials.

Bolsonaro’s lawyer, Paulo Cunha Bueno, said the court also barred the former president from using social media or communicating with his son, Eduardo, who has been in Washington lobbying the Trump administration to intervene in his father’s case.