President Jair Bolsonaro's supporters chanted "Our flag will never be red!" — a jab at the colours of leftist rival Luiz Inacio Lula da Silva's party amid a military choir.
Judge Fachin underlined that his decision came "in light of recent and unfortunate episodes of political violence."
Several businessmen are being investigated over messages on WhatsApp that backed a coup should the far-right Jair Bolsonaro lose October vote to rival Lula da Silva, local media say.
The prosecutor general's office says it will appeal the Supreme Court's decision.
Brazil's top judge Jose Antonio Dias Toffoli ruled that the full court would have to take up the case of former president Luiz Inacio Lula da Silva after it returns from holiday recess.
Former Brazilian president Luiz Inacio Lula da Silva was registered as a candidate for the next election by his party despite serving a 12-year sentence for corruption.
Judge Sergio Moro, who sent Lula to prison in April for a bribery conviction, said that the appeals court judge lacked authority to issue an order freeing the former president for campaigning in the run-up to the October vote.
Leftist icon Luiz Inacio Lula da Silva spends Sunday as Brazil's first former president to be imprisoned for money laundering and corruption.
Former Brazilian president Luiz Inacio Lula da Silva says he would turn himself in to police, in his first comments after the arrest warrant. He has been given 12-year prison sentence for accepting a luxury apartment as a kickback.
He had been required to hand himself over by 5 pm local time, but had failed to do so. He was reportedly holed up in the metal workers union building in his hometown Sao Bernardo do Campo, surrounded by supporters.
Federal judge Sergio Moro said Lula must "present himself voluntarily" to police in the southern city of Curitiba, where the "Car Wash" probe is based, by 2000 GMT (5pm) on Friday.
Brazil's top prosecutor alleged that some members of the Workers Party, including Lula and Rousseff, committed a series of crimes involving state-owned oil firm Petrobras such as cartel formation, corruption and money laundering.
Subscribe to our Youtube channel for all latest in-depth, on the ground reporting from around the world.
Copyright © 2022 TRT World.