It is worth standing back from the impeachment proceedings in Brazil, and impending regime change, to ask: “What does this mean for Brazil’s standing in the world?” Notoriously, Charles de Gaulle is said to have dismissed the country as not serious, but a place for samba, carnival and playboys. And, until the military dictatorship died in the 1980s and Fernando Henrique Cardoso sorted out the currency and killed inflation in the 1990s, it lacked the conditions to become a world power.

All that has changed now and a great deal is thanks to the Workers’ party (PT) governments of presidents Luiz Inácio Lula da Silva (2003-11) and the embattled Dilma Rousseff (2011 onwards). It was mostly thanks to Lula, who won the presidency at the fourth attempt after ditching overt socialism. He travelled tirelessly, especially around Africa, to build alliances of developing states and a distinctive independent line. This was south-south, with strong hints of anti-Americanism.

Will the inward-looking deputies and senators remember that Brazil is not an island, but rather part of Latin America?

This paid off. Brazil was recognised as a key player in the G20 and saw its citizens elected to international posts – José Graziano da Silva become secretary general of the Food and Agriculture Organisation in 2012; Roberto Azevedo became director general of the World Trade Organisation in 2013. When the New Development Bank was set up in Shanghai for the Brics – Brazil, Russia, India, China and South Africa – it was designed to challenge the dominance of the World Bank in international development. Capturing both the World Cup and the Olympics within two years was an achievement which rewarded Lula’s skill in mobilising sporting bodies, civil society and the media. The fact that some stadia are white elephants has haunted his successor.

In Latin America itself the PT governments worked to bring together the sub-regional groups which serve the southern cone, and the Andean states. In 2008 in Brasilia it was agreed to set up the Union of South American Nations (Unasur), loosely modelled on the EU; based in Quito this would have 12 ministerial councils, a parliamentary assembly and its own bank. Like the EU it has had teething troubles.

Outsiders saw a red tide flowing through South America – of the late Hugo Chávez in Venezuela, Evo Morales in Bolivia, the Kirchners in Argentina, Rafael Correa in Ecuador and, of course, Lula in Brazil. But although each shared a commitment to national sovereignty their politics were far from identical and there could be frictions, as when Morales nationalised oil and gas and put supplies to Brazil at risk. Lula had warm relations with Chávez; Dilma, while supporting the election of his successor, Nicolás Maduro, has never had quite the same closeness.

So what will happen now? Brazil’s economy is in decline, threatening the PT success in bringing the poor into a “new middle class”. The publicity surrounding the Petrobras scandal and the way in which the impeachment has been pressed for by the right could lead cynics to aver that one set of crooks has conspired to throw out another. Along the way Brazil’s international reputation and capacity for progressive diplomacy have been damaged. It is not clear that the country will gain respect for a house-cleaning unless all the corrupt politicos are thrown out and, while there are problems about getting rid of an inadequate executive president ahead of term in the many states which have such presidencies, the current example in Brasilia looks partisan.

For the world needs Brazil. For years the ability of its diplomats, centred in the beautiful Niemeyer building in Brasilia, which has now been witnessing anti-Rousseff demonstrations, has been admired. Geographically and politically it is the hinge on which its predominantly Spanish-speaking neighbours must turn. There are issues it can help resolve.

For example, in 2015 Venezuela suddenly claimed to annexe nearly all the maritime waters off Guyana, also threatening the exclusive economic zones of eight other states including Colombia. It then backed down with Colombia, but ordered its navy to arrest vessels off Guyana, including an Exxon-Mobil survey ship which was looking for oil and gas in recognised Guyanese waters. Venezuela has revived a claim to two-thirds of Guyana – territory which neither it nor its Spanish imperial predecessors have ever occupied.

Carl Greenidge, vice-president of Guyana, told a Ramphal Institute audience in London on Monday that this was straightforward bullying. The original Guyana-Venezuela border was arbitrated at the turn of the 20th century with Brazil as a guarantor of the resulting line. The last thing Brazil wants is a recurrence of boundary disputes around its periphery, fuelled by greed for oil and minerals, and an active foreign policy can help to calm this controversy.

But with the stasis in Brasilia will the inward-looking deputies and senators remember that Brazil is not an island, but rather part of Latin America? It is certainly true that, particularly thanks to Lula’s energy and flair, Brazilians are now regarded as world citizens. The fallout from Brasilia will be worldwide.