(Bloomberg) -- Supreme Court Justice Alexandre de Moraes was sworn in as head of Brazil’s electoral court Tuesday in a ceremony attended by dignitaries including President Jair Bolsonaro just weeks ahead of what’s expected to be a hotly contested election.

Moraes takes over the electoral court, known as the TSE, at a challenging time. The judge has had to open numerous probes of social media campaigns aimed at undermining faith and confidence in the integrity of the electronic voting system Brazilians will use in October’s general election.

In his remarks at the ceremony, Moraes alluded to those same attacks, often egged on by Bolsonaro himself at public appearances and on social media, commenting at one point that that “freedom of expression is not freedom of aggression.” 

Still, in a sign that both men may be open to a truce, the president personally attended the ceremony. Also present were his leftist challenger, Luiz Inacio Lula da Silva, as well as several former heads of state, other presidential candidates, government officials and central bank chief Roberto Campos Neto.

In a radio interview on Wednesday, Lula described Tuesday’s ceremony as a demonstration of civility. 

Moraes’s task won’t be easy. In his efforts to uphold the credibility of the election’s result, he’s fighting an army of Bolsonaro’s supporters who repeatedly spread falsehoods about electronic ballots on social media, often led by the president himself. Many Brazilian watchers worry the incumbent is laying the ground to mimic Donald Trump and challenge the election’s result in case he’s defeated.

“We are the only democracy in the world that calculates and publishes electoral results on the same day with agility, security, competence and transparency,” Moraes said in a speech applauded by most of the audience, except Bolsonaro and members of his cabinet.

As a top court justice and now the head of the electoral authority, Moraes has a broad range of tools at his disposal. Among them, he leads what’s widely known in Brazil as the Fake News Inquiry, an investigation into lies and threats against the justices and their families. 

Read More: Bolsonaro’s Brawl With a Top Justice Tests Brazil’s Democracy

Moraes had already sent some of Bolsonaro’s top backers to jail. He sentenced congressman Daniel Silveira to prison for posting a video on social media threatening the justices, although the next day Bolsonaro granted his ally a presidential pardon. The justice also briefly banned Telegram, a social-media service often used by Bolsonaro’s supporters.

Bracing for a possible showdown, Bolsonaro has constantly targeted Moraes and other fellow top justices during public speeches, even saying that he would not comply with his decisions.

Yet last week both men met at the presidential palace, and Moraes personally invited Bolsonaro to his swearing in ceremony in an apparent attempt to reduce animosity between them.  

(Updates with comment from Lula in fifth paragraph.)

©2022 Bloomberg L.P.