Former President Luiz Inacio Lula da Silva, who is leading in the polls for Brazil's October presidential election, said on Saturday he will not tolerate threats against institutions, and that the armed forces need to commit to democracy.
"It is necessary to overcome authoritarianism and anti-democratic threats. We will not tolerate any kind of threat on the institutions that represent the popular vote," Lula said in a speech in the northeastern city of Salvador.
Three other presidential candidates also attended the event to celebrate the independence of the State of Bahia, including right-wing President Jair Bolsonaro, who is running for re-election.
Lula was president of Brazil from 2003 to 2011.
Military leaders have repeatedly said Brazil's armed forces will respect any result of the election, but military officials have made headlines by echoing comments by Bolsonaro about potential weaknesses in Brazil's voting system.
A former Army captain, Bolsonaro has placed several military personnel in key positions traditionally held by civilians in the government. In May, he suggested the military should conduct its own parallel ballot count alongside the court.
Bolsonaro has threatened since last year not to accept the results of the October presidential election, and unsuccessfully tried to make a constitutional amendment to Brazil's voting method, advocating a return to a paper ballot system. His reasons for these actions are based on continual and unproven claims of fraud in the country's electronic voting system.
Lula said at Saturday's event: "It is necessary to re-establish an environment of political, economic and institutional stability that provides confidence and security to investments that are of interest to the country's development."
He defended the importance of the military for the country, while emphasizing they must have a commitment to democracy.
"The independent and sovereign Brazil that we want cannot give up its armed forces. Not only well-trained and equipped, but, above all, committed to democracy," Lula said.
Lula drew 47% support against Bolsonaro's 28% in a Datafolha opinion poll at the end of June.