Half a century ago, Jean Marc von der Weid was strapped to a pole and bludgeoned with clubs by Brazilian security agents seeking information about his fellow leftist student leaders.
His torturers also attached wires to his fingers, toes, ears, tongue and penis, and blasted him with electric shocks. At one point, he recalls, they subjected him to a simulated firing squad.
"They said, 'If you don't talk, we will definitely shoot you,' " says von der Weid. "I remember one guy saying, 'Do you want to smoke your last cigarette?' I replied: 'No thanks, I don't smoke.' "
"That wasn't bravery. I simply wasn't thinking too well."
Von der Weid endured these atrocities over five days in September 1969 during one of the most brutal phases of a military dictatorship that lasted in Brazil for just over two decades. He was 23 and the leader of a banned student organization.
Until recently, few observers imagined that Brazil, now Latin America's largest democracy, was at significant risk of revisiting this chapter in its past. Not any more.
"This is a very, very worrying time," says von der Weid, 72.
Brazilians are preparing for an election that will determine whether their next president will be Jair Bolsonaro, a congressman and retired army captain who has openly, and often, expressed his admiration for the 1964-85 military regime as a period of order and tranquility.
Polls predict Bolsonaro will win. He took the first round, on Oct. 7, with a huge margin of nearly 18 million votes over his nearest rival, Fernando Haddad, the leftist Workers' Party candidate. They face each other in a runoff on Sunday.
If that happens, Bolsonaro will assume the presidency of Brazil on Jan. 1, supported by his vice president — retired army Gen. Hamilton Mourão — along with a coterie of retired military commanders who are advisers, some of whom are expected to join his Cabinet.
What might follow, once Bolsonaro is installed in the presidential palace, is the source of impassioned debate in Brazil.
The election campaign has been ugly. Social media and texting platforms have been engulfed by acrimonious arguments and awash with lies and misleading information. There were 71 election-related attacks in the first 11 days of this month alone, according to Pública, a Brazilian investigative journalism agency monitoring political violence. These include the killing of Moa do Katendê, an Afro-Brazilian master of capoeira, a martial art combining music and dance, who was stabbed after an argument with a Bolsonaro supporter in the city of Salvador.
"Dark forces, from within and from without, now seem to be forcing us backward and down," wrote the celebrated musician Caetano Veloso, in a New York Times op-ed this week. Veloso was among the artists and intellectuals imprisoned by the military junta in the 1960s; he ended up spending more than two years in exile abroad.
"If Mr. Bolsonaro wins the election, Brazilians can expect a wave of fear and hatred," Veloso wrote.
Bolsonaro himself dismisses predictions that he is a threat to democracy as "fake news" circulated by his enemies. He has said he wants a government "with authority but without authoritarianism" and describes himself as a "slave" to Brazil's Constitution.
He insists that he is not interested in a military takeover. "That doesn't go through our mind," Bolsonaro told NPR in April. "Not even the military wants that."
However, several recent incidents have reinforced suspicions about his intentions. In a speech last weekend, Bolsonaro described his opponents as "red bandits" and vowed to "wipe them off the map" in a "cleansing that has never been seen before in the history of Brazil."
Alarm bells began ringing louder still when a video emerged in which Bolsonaro's third son, Eduardo, a congressman, states that Brazil's Supreme Court could be closed if it tries to remove his father from the presidency.
"You don't even need to send a jeep. Send two soldiers," said Eduardo Bolsonaro, on the video, which was recorded in July.
"What is the Supreme Court, man? Remove the power of a justice's pen, who is he on the streets? If you arrest a justice, do you think people will protest in his favor?"
Brazil's chief justice responded by saying an attack on the judiciary is an attack on democracy itself. Jair Bolsonaro distanced himself from his son's remarks, characterizing them as a mistake.
Bolsonaro's remarkable rise from political obscurity is being propelled by the deep contempt with which many Brazilians now view mainstream politicians. They are especially angry with the Workers' Party, which ran the government for more than 13 years, from January 2003 to August 2016. That period included a deep recession, and the start of the "Car Wash" investigation that exposed a massive kickbacks-for-contracts scam involving top politicians and business executives, including former President Luiz Inácio Lula da Silva.
Bolsonaro, 63, is a seven-term congressman, yet he has successfully marketed himself as an outsider, a squeaky-clean patriot who will champion the fight against corruption and violent crime and restore the nation's pride and traditional Christian values.
Many millions of Brazilians are rallying to his battle cry. But research suggests that most of the country wants to preserve democracy. In a Datafolha poll this month, 69 percent defined democracy as the best form of government. Twelve percent said they would prefer a dictatorship.
Bolsonaro has sought to deflect accusations that he is a dictator in the making by channeling the same allegation toward his opponent, Haddad, portraying his Workers' Party as an ally of the authoritarian leftist government in Venezuela, which is in economic collapse.
Haddad, 55, is a former political science professor who has served as mayor of São Paulo and as a federal government education minister. His record, in fact, shows him to be a center-left moderate.
As Brazil's presidential election approaches, policymakers and investors worldwide are watching closely in the hope of detecting the contours of Bolsonaro's policies. Some of the country's most powerful forces, including the evangelical and agribusiness lobbies in Congress, are behind him.
Some of his agenda is already clear: His desire to loosen Brazil's environmental laws, which he says stifle economic growth, is causing deep alarm at home and abroad among those fighting for the preservation of the Amazon rain forest.
He favors allowing the Brazilian public to carry guns and advocates for police to use more lethal force against suspects — a practice already commonplace in impoverished, predominantly black neighborhoods where rogue cops and criminal gangs battle for control of the narcotics trade.
Internationally, Bolsonaro is strongly pro-Israel and is likely to move the Brazilian Embassy from Tel Aviv to Jerusalem, as the U.S. did with its embassy in May. He leans heavily toward the United States and much admires President Trump, who he says is pioneering "a new way of doing politics."
"I intend to get much closer to the U.S.," Bolsonaro told NPR in April.
He has criticized Brazil's biggest trading partner, China, arguing that the Chinese are not simply investing in the country — but buying it.
Also watching closely is von der Weid, who is now an agroecologist.
About a third of his 209 million fellow Brazilians were born after the military dictatorship and know little of its abuses. These include 434 deaths and disappearances, according to Brazil's National Truth Commission, which investigated atrocities committed during military rule.
"The military in Brazil have never admitted that they made a mistake and committed a crime," says von der Weid. "And they have never been punished."
If Bolsonaro becomes president, von der Weid expects him eventually to come into confrontation with Congress and the judiciary.
"Bolsonaro's instincts and ... everything he says push toward a confrontation with the [government] institutions," he says.
The key question is whether Brazil's military "goes along with him or not," he says.
The torture that von der Weid suffered as a radical student leader, half a century ago, left him with some permanent hearing loss in his right ear; a crack in a bone in his spine, and — for a while — recurring nightmares.
Yet the greater legacy is an unsettling feeling that in today's Brazil, history could easily repeat itself.