Brazil used to be a country of dictatorship, hyperinflation and political mismanagement on a grand scale. Then it became the world's third-largest democracy, the second-largest destination of foreign investment after China, and built a stable new currency, the real.
Now it stands once again on the brink of economic meltdown. On September 3rd the risk agency Moody's lowered Brazil's rating to the same as Paraguay and Nicaragua, which triggered a virtual free-fall in the Rio and Sao Paulo stock exchanges that shows no sign of abating.
Now Brazil is looking even more like it will be the next victim of this year's global financial turbulence as its stocks hit record lows, dollars haemorrhage out of the country and pressure increases on its currency, the real, to devalue. Brazil is the largest economy in Latin America, accounting for 45 per cent of its GDP, and if it devalues many economists expect it to tip the rest of the continent into recession.
Brazil's economy is the ninth largest in the world - twice the size of Russia's - and any collapse would have a much greater effect on the world economy than that of Russia when it defaulted on its debts. The US especially could be affected because Latin America is the most important emerging market for US exporters and because Mexico is part of the North Atlantic Free Trade Area.
Some believe a devaluation of the real could spread chaos back to the Far East, pressurising the Hong Kong dollar's peg and, if that goes, opening the door to a Chinese devaluation.
Brazil is vulnerable to a speculative attack because the real is overvalued by between 20 to 30 per cent and the country has an unsustainable budget deficit of about 7 per cent of GDP. Its only buffer has been reserves of US $70 million (£47.2 million), but even these have dwindled to less that US $50 million this month as the government has tried to back up the real. Fears of a devaluation in Brazil reached fever pitch in the first two weeks of September when the country was losing an average of $1.5 billion a day.
Although outflows have slowed since, thanks in part to a drastic hike in interest rates to nearly 50 per cent a year, dollars are still leaving the country and the Sao Paulo stock market is running at about 40 per cent down on its peak in July.
To complicate matters Brazil is in the final stages of an election campaign, which means that President Fernando Henrique Cardoso is unable to introduce long-term financial reforms.
The markets stabilised this week and it now looks like the currency will survive until the election on October 4th next. President Cardoso has a runaway lead in the polls despite the financial troubles because voters still identify him as the man who tamed hyperinflation four years ago.
Mr Cardoso will need to announce wide-ranging curbs in the budget to ease the threat of devaluation. But his hands will be tied because high interest rates mean that Brazil is already heading into a recession. Also, it is likely that the conservative parties will make substantial gains in the Brazilian congress, making any reforms more difficult.
"[The government is] going to have to come up with some pretty major announcements on the Monday [after the Sunday elections]," said Mr Diniz Pignatari, head of foreign exchange at ING Barings bank in Sao Paulo. "But if it's not convincing or feasible, the markets are not going to like it one bit."
The US has said it will back Brazil to stave off devaluation and Brazilian officials have been talking with the IMF about possible financial support involving the World Bank and the G7 nations. However, the Brazilian Finance Minister, Mr Pedro Malan, stressed that Brazil was not seeking a bailout similar to the emergency packages put together last year for several Asian economies and more recently for Russia. "At no time have we talked about a rescue similar to what happened in the Asian countries that involved millions of dollars after the crisis occurred," Mr Malan said this week. "We want a preventive operation, not a rescue."
The current crisis is a complete turn-around for Brazil, which has been considered a darling of developing markets since the centrist Mr Cardoso took power. In July this year, when it sold off its telecommunications giant, Telebras, for 60 per cent more than the asking price, Brazil was seen as restoring confidence in the world's emerging markets. However, the decline of the country's fortunes has made the job of capitalising Brazil's natural wealth all the more difficult. It has also brought a sense of urgency to the forthcoming elections, the outcome of which may decide the economic fate of Brazil.