The story of Brazil’s political crisis, and the rapidly changing global perception of it, begins with its national media. The country’s dominant broadcast and print outlets are owned by a tiny handful of Brazil’s richest families, and are steadfastly conservative. For decades, those media outlets have been used to agitate for the Brazilian rich, ensuring that severe wealth inequality (and the political inequality that results) remains firmly in place.

Indeed, most of today’s largest media outlets – that appear respectable to outsiders – supported the 1964 military coup that ushered in two decades of rightwing dictatorship and further enriched the nation’s oligarchs. This key historical event still casts a shadow over the country’s identity and politics. Those corporations – led by the multiple media arms of the Globo organisation – heralded that coup as a noble blow against a corrupt, democratically elected liberal government. Sound familiar?

For more than a year, those same media outlets have peddled a self-serving narrative: an angry citizenry, driven by fury over government corruption, rising against and demanding the overthrow of Brazil’s first female president, Dilma Rousseff, and her Workers’ party (PT). The world saw endless images of huge crowds of protesters in the streets, always an inspiring sight.

But what most outside Brazil did not see was that the country’s plutocratic media had spent months inciting those protests (while pretending merely to “cover” them). The protesters were not remotely representative of Brazil’s population. They were, instead, disproportionately white and wealthy: the very same people who have opposed the PT and its anti-poverty programmes for two decades.

Slowly, the outside world has begun to see past the pleasing, two-dimensional caricature manufactured by its domestic press, and to recognise who will be empowered once Rousseff is removed. It has now become clear that corruption is not the cause of the effort to oust Brazil’s twice-elected president; rather, corruption is merely the pretext.

Rousseff’s moderately leftwing party first gained the presidency in 2002, when her predecessor, Luiz Inácio Lula da Silva, won a resounding victory. Due largely to his popularity and charisma, and bolstered by Brazil’s booming economic growth under his presidency, the PT has won four straight presidential elections – including Rousseff’s 2010 election victory and then, just 18 months ago, her re-election with 54 million votes.

Women carrying flowers take part in a ‘flowers for democracy’ demonstration against the impeachment of Dilma Rousseff. Photograph: Eraldo Peres/AP

The country’s elite class and their media organs have failed, over and over, in their efforts to defeat the party at the ballot box. But plutocrats are not known for gently accepting defeat, nor for playing by the rules. What they have been unable to achieve democratically, they are now attempting to achieve anti-democratically: by having a bizarre mix of politicians – evangelical extremists, far-right supporters of a return to military rule, non-ideological backroom operatives – simply remove her from office.

Indeed, those leading the campaign for her impeachment and who are in line to take over – most notably the house speaker Eduardo Cunha – are far more implicated in scandals of personal corruption than she is. Cunha was caught last year with millions of dollars in bribes in secret Swiss bank accounts, after having falsely denied to Congress that he had any foreign bank accounts. Cunha also appears in the Panama Papers, working to stash his ill-gotten millions offshore to avoid detection and tax liability.

It is impossible to convincingly march behind a banner of “anti-corruption” and “democracy” when simultaneously working to install the country’s most corruption-tainted and widely disliked political figures. Words cannot describe the surreality of watching the vote to send Rousseff’s impeachment to the Senate, during which one glaringly corrupt member of Congress after the next stood to address Cunha, proclaiming with a straight face that they were voting to remove Rousseff due to their anger over corruption.

As the Guardian reported: “Yes, voted Paulo Maluf, who is on Interpol’s red list for conspiracy. Yes, voted Nilton Capixaba, who is accused of money laundering. ‘For the love of God, yes!’ declared Silas Camara, who is under investigation for forging documents and misappropriating public funds.”

But these politicians have overplayed their hand. Not even Brazil’s Masters of the Universe can convince the world that Rousseff’s impeachment is really about combating corruption – their scheme would empower politicians whose own scandals would be career-ending in any healthy democracy.

Eduardo Cunha was caught last year with millions of dollars in bribes in secret Swiss bank accounts. Photograph: Andressa Anholete/AFP/Getty Images

A New York Times article last week reported that “60% of the 594 members of Brazil’s Congress” – the ones voting to impeach Rousseff – “face serious charges like bribery, electoral fraud, illegal deforestation, kidnapping and homicide”. By contrast, said the article, Rousseff “is something of a rarity among Brazil’s major political figures: she has not been accused of stealing for herself”.

Last Sunday’s televised, raucous spectacle in the lower house received global attention because of some repellent (though revealing) remarks made by impeachment advocates. One of them, prominent rightwing congressman Jair Bolsonaro – widely expected to run for president and who a recent poll shows is the leading candidate among Brazil’s richest – said he was casting his vote in honour of a human-rights-abusing colonel in Brazil’s military dictatorship who was personally responsible for Rousseff’s torture. His son, Eduardo, proudly cast his vote in honour of “the military men of ’64” – the ones who led the coup.

Until now, Brazilians have had their attention exclusively directed towards Rousseff, who is deeply unpopular due to the country’s severe recession. Nobody knows how Brazilians, especially the poor and working classes, will react when they see their newly installed president: the pro-business, corruption-tainted nonentity of a vice-president who, polls show, most Brazilians want impeached.

Most volatile of all, many – including the prosecutors and investigators who have led the corruption probe – fear that the real plan behind Rousseff’s impeachment is to put an end to the ongoing investigation, thus protecting corruption, not punishing it. There is a real risk that once she is impeached, Brazil’s media will no longer be so focused on corruption, public interest will dissipate, and the newly empowered faction in Brasilia will be able to exploit its congressional majorities to cripple that investigation and protect themselves.

Ultimately, Brazil’s elite political and media classes are toying with the mechanics of democracy. That’s a dangerous, unpredictable game to play anywhere, but particularly so in a very young democracy with a recent history of political instability and tyranny, and where millions are furious over their economic deprivation.