ON APRIL 1st 1964 units of the Brazilian army toppled the democratic government of João Goulart, a left-wing president. They did so with the support of the elected civilian governors of the three most important states—Minas Gerais, Rio de Janeiro and São Paulo—and much of the congress. The politicians were convinced that the army would merely hold the ring until the election due in 1965. They miscalculated: the generals went on to rule the country for two decades.

Some Brazilians see a similar civilian-military collaboration, in reverse, in the likely victory in the presidential election this month of Jair Bolsonaro, a former army captain. Mr Bolsonaro is a fervent defender of the military dictatorship and a fan of Chile’s former dictator, Augusto Pinochet. He has said he would appoint military people as ministers. His running-mate is Hamilton Mourão, a retired general who last month mused about a “self-coup” if the country slid into anarchy. Partly on Mr Bolsonaro’s coat-tails, 17 military men and seven police officers, all on leave, were elected to congress on October 7th.

The army has edged towards the political arena in other ways. In April, shortly before the supreme court considered an appeal by Luiz Inácio Lula da Silva, a former president from the left-wing Workers’ Party (PT), against his jailing for corruption, General Eduardo Villas Bôas, the commander of the army, tweeted that his institution “shares the desire of all good citizens to repudiate impunity”. The court rejected the appeal. The new supreme-court president has appointed a general as an adviser.

Only three years ago Fernando Henrique Cardoso, a former president, could say that, despite an economic slump and a huge corruption scandal involving many politicians, Brazil had evolved because “we know the names of supreme-court justices but not of generals.” It is worrying that this is no longer true. But is it worse than that?

Certainly there are a few parallels with 1964. Now, as then, Brazilian politics is polarised between left and right. Goulart was a would-be reformer but an ineffectual one. He was a disastrous manager of the economy, just as the PT was under Dilma Rousseff, Lula’s successor, who governed from 2011 until she was impeached in 2016. In 1964 the military plotters feared, not without reason, that Goulart was planning his own coup against congress and the governors. Less plausibly, they feared that he was leading Brazil down the road of Fidel Castro’s then-recent communist revolution in Cuba, just as Mr Bolsonaro’s supporters fear, wrongly, that the PT would turn Brazil into Venezuela.

Yet none of this means that Mr Bolsonaro, assuming he wins, would or could attempt to replicate the dictatorship. His rise reflects widespread hatred of the PT and a popular demand for change, economic renewal and security in the face of a failing political system, economic slump and a crime wave—but not necessarily for military rule. “This is not the cold war,” says Matias Spektor, who teaches international relations at the Fundação Getulio Vargas, a university. The media and a vibrant civil society support democracy.

Neither is there reason to believe that the armed forces want to take over. They are proud to be Brazil’s most respected institution. General Villas Bôas has said that “hotheads” who call for a coup are “crazy”. He has criticised efforts, which Mr Bolsonaro champions, to involve the army in fighting organised crime. (It is already policing the city of Rio de Janeiro.) Most senior officers are moderates who don’t want to take unconstitutional action, according to Alfredo Valladão, a defence specialist. “The army will take its own decisions”, not bow to Mr Bolsonaro, he says. Indeed, if Mr Bolsonaro wins, its resistance to complete civilian control may prove to be a restraint on him. The army would feel forced to intervene, Mr Valladão adds, only if Brazil slid into large-scale political violence.

More than an organised right-wing movement, Mr Bolsonaro commands an authoritarian current of opinion. He may be more intent on dynasty than dictatorship. One of his sons has become the congressman with the most votes; another was elected senator; a third is his foreign-policy adviser. Rather than a flashback to 1964, Mr Bolsonaro represents a more insidious threat. He expresses extreme views. He has said that the dictatorship erred in “torturing rather than killing”. He wants the police to kill more “criminals”, and to liberalise gun ownership. He has talked about packing the supreme court. As Mr Spektor puts it, it is the quality of Brazilian democracy, rather than its survival, that is at more immediate risk.