If Brazil was a hospital patient, emergency room doctors would diagnose it as being in terminal decline. The kidneys have packed up; the heart will go soon. That, at any rate, is the damming opinion of a senator from the Workers’ party, which has governed Brazil for 13 years, overseeing both its rise on the global stage and now its terrible fall.

The economy is in a mess. Brazil’s worst recession since the Great Depression will see the economy shrink by as much as 3 per cent this year, and 2 per cent in 2016. Public finances are in disarray: this month, the government, for the first time since the onset of democracy, forecast it would post a primary fiscal deficit, the budget balance before interest payments. The actual budget deficit is already a yawning 9 per cent of output. As a result, debt levels are growing again.

That is the immediate reason behind last week’s surprise decision by Standard & Poor’s to downgrade Brazilian debt to “junk”. If another rating agency follows, many overseas investors will have to sell their Brazilian holdings, making matters worse; around a fifth of Brazil’s debt is foreign-owned. Given the tough external environment — China’s slowing economy, the collapse in commodity prices, and higher US interest rates — Brazil is suffering the beginnings of extreme economic stress.

Ironically, though, it is not Brazil’s building economic problems that prompted S&P. Rather it is the full-blown political crisis. Dilma Rousseff, the president, is unloved by her own party, and deeply disliked elsewhere: she is the most unpopular president in Brazilian history. That makes it all but impossible for her to respond properly to the economic turmoil. That is especially so as much of Congress is more focused on saving its own skin from a probe into a corruption scam that bilked $2bn from state-controlled energy company,Petrobras. Brazil’s political system is well-known to be rotten. Now it is not working either.

Wholesale political renewal is one solution. Sadly, there is little chance of that until scheduled elections in 2018. Unpopularity is insufficient reason to remove Ms Rousseff: if it was, Fernando Henrique Cardoso, the former president who laid the grounds of Brazil’s now-squandered economic stability, would not have lasted his second term. Brazil’s presidential system also means Ms Rousseff cannot dissolve Congress and call fresh elections.