Voters in Brazil and the US face elections in the coming weeks whose outcomes will directly influence the future of democracy in the Americas.

In Brazil, the candidate who captured 46% of the votes in Saturday’s first-round presidential elections, Jair Bolsonaro, is pro-torture and speaks in favor of military rule as a way to solve deep societal problems. Bolsonaro will face leftist Fernando Haddad, who gained 29.3% of the first-round votes, in final elections on 28 October.

In the US, the process of filling Anthony Kennedy’s seat on the supreme court underscored the indifference, if not contempt, with which President Trump and Republicans in Congress treat basic democratic norms. Pro- and anti-Trump forces have mobilized voters around this and other crucial issues, such as immigration and women’s rights, for the 6 November elections.

Despite differing histories and cultures, recent political events and electoral campaigns in Brazil and the US exhibit striking similarities. In North and South America alike, they raise a haunting question: in the human rights struggles of the 21st century, who will count as citizens?

Brazil is the fourth largest democracy in the world, and the US the second largest. In 2002 and 2008, respectively, the voters of both countries elected presidents different from any who had preceded them: in the US, an African-American, and in Brazil, a steel worker and union leader with little formal education. Each of these presidents, Luiz Inácio Lula da Silva and Barack Obama, fostered gender and racial inclusion and implemented key aspects of the left-of-center platforms on which they had campaigned.

Lula brought millions of Brazilians out of poverty with his bolsa familia program of aid to poor families and opened Brazil’s universities to black and working-class students. Obama extended medical access to millions through his health insurance reform, supported racial and gender equality through federal policies and supreme court appointments, and joined the Paris accords to mitigate climate change.

At the same time, each president chose not to rock the boat economically, achieving substantial economic growth through mainstream economic policies.

And each has been followed by a brutal rightwing backlash.

The similarities go deeper. Lula and Obama each served two terms, and each was succeeded in his own party by a female presidential candidate, further opening the path to inclusion. Each woman appeared more mainstream and cautious than her predecessor, while remaining committed to a modestly progressive agenda.

What happened? Dilma Rousseff won elections in 2010 and 2014, but before she could complete her second term, rightwing forces impeached her, replacing her with conservative vice president Michel Temer. While technically legal, the impeachment process saw Rousseff ousted for minor transgressions by famously corrupt male politicians.

In 2016, Donald Trump defeated Hillary Clinton in elections that were legal but marred by charges of Russian interference, hacking of email accounts, politically timed FBI revelations, and incitements to violence. Trump also lost the popular vote.

Despite their questionable pathways to the presidency, Trump and Temer have each moved, from the moments they assumed office, to dismantle inclusionary economic policies and social programs implemented by their predecessors. They have enacted draconian policy shifts to a degree few would have imagined possible in either country, including the gutting of entire programs in education, family support, housing, university access, and environmental protection. To carry out this slashing of programs promoting equality and inclusion, Trump and Temer each appointed nearly all-wealthy, all-male, all-white cabinets.

The current electoral campaign in Brazil has deepened the similarities between Brazilian and US politics. Brazil’s leading presidential candidate, Bolsonaro speaks in fiercely derogatory ways about women, racial minorities, immigrants, and LGBTQ people. Like Trump, Bolsonaro favors encouraging police to shoot first and ask later and praises authoritarian rulers, in Brazil’s case the generals who ruled Brazil from 1964-1985. Many Brazilians rightly fear that a Bolsonaro victory could bring the military, along with repression and torture of dissidents, back into politics. In 2016, when Bolsonaro cast his vote in favor of the impeachment of Rousseff, he did so in honor of Carlos Brilhante Ustra, the most feared torturer of the dictatorship.

In an August interview on TV Globo, Brazil’s premier TV network, Bolsonaro ignored requests from the interviewers for policy proposals, but insisted at length on the dangers of discussing gender and sexuality in schools. Making patently false claims about textbooks and classroom instruction, he proclaimed in this prominent national interview that “no father would want to come home and find his son playing with dolls, because his teacher had suggested it”. Like Trump, Bolsonaro follows the demagogues’ playbook and makes a sham out of previously respected norms, signaling his contempt for media and institutions that oppose him.

What do these striking similarities portend for democratic politics?

After watching two years of marches, social media campaigns, and electoral initiatives begin to take shape in the US, I traveled to southern Brazil in August. In a region with a long history of political activism in social movements and political parties, I found people feeling alternately enraged and powerless.

This felt familiar. First, media spectacle has replaced politics: what will Bolsonaro or Trump say or do next? The spectacle intensified in Brazil when Bolsonaro was stabbed at a political rally, undergoing major surgery and continuing his campaign from a hospital bed, to growing popularity. Brazilian elections also follow on corruption scandals that rocked politicians and businesspeople across the political spectrum, including key figures in the Lula, Dilma, and Temer governments.

Second, citizens respond to unfolding political events with a combination of surprise, outrage, and powerlessness. In both Brazil and the US, majorities voted repeatedly for progressive democratic politics, with government acting to lessen inequality and widen opportunities. These voters, many of them young and new to electoral politics, believed, with the elections of Lula and Obama, that a corner had been turned. Both countries saw a new, if cautious, politics of rights and political participation, the continuation of political movements and social changes that had begun in the mid-20th century.

In conversation with Brazilians, I realized that the widespread outrage at the questionable impeachment of Rousseff, widely characterized as a coup, mirrors the mixture of rage and powerlessness with which many in the US view the Republican outmaneuvering of Merrick Garland’s nomination to the supreme court and the subsequent appointment of Brett Kavanaugh. The confirmation of a conservative justice by the Republicans in Congress, like the impeachment of Rousseff in Brazil, will change policies that affect millions of people.

The US senate’s refusal to vote on Garland, like the Brazilian congress’s impeachment of Rousseff, was legal in procedure, but transgressed key democratic norms. The two rounds of Kavanaugh hearings, from discussion of the candidate’s political and judicial past to examination of charges of sexual assault, have only deepened widespread feelings of powerlessness in the face of manipulated legality.

In the US, we rarely look outside our own country to explain our current politics. When we do, it is generally with a nod eastward, to rising populisms in Europe that seem to pivot around immigration.

I discovered that the same goes for Brazilians. While they are well aware of the characteristics of Trump and his presidency, few look to the US to understand the dynamics of their country’s political crisis. In August, however, as I spoke with Brazilians, I found myself repeatedly ticking off the many similarities between the two countries’ trajectories. And wondering, are there common forces that produced such similar results in two such different democracies, north and south?

The Americas story seems to be this: male black or working-class presidents – and the white female presidents or presidential candidates who followed them – drew together coalitions to carry forward the civil rights struggles of the past for decent economic lives and cultural inclusion. They proceeded with great caution, to the chagrin of some of their supporters, and did not attempt to increase taxes, redistribute wealth, question globalization, or adjust markets to promote wellbeing. Nevertheless, these coalitions for change elicited fierce and brutal backlashes that have redistributed wealth upward and target, especially, women, people of color, LGBTQ people, and the poor.

• Jeffrey W Rubin is a professor of History at Boston University and the author of Sustaining Activism and Enduring Reform