Over the past several weeks, an economic and political crisis of a magnitude and scale not seen in over a generation has gripped Brazil. Economic stagnation has taken the place of what was once robust economic growth. The country’s GDP is expected to contract 0.5% this year. Unemployment is at 6% and rising fast. And inflation, which had been tame for the past 20 years, raised its ugly had once again as it passed the 8% mark. All of these developments have taken a heavy toll on second term president Dilma Rousseff, who has seen her approval rating plummet to 34%. In recent weeks over 1 million people took to the streets of Sao Paulo demanding Dilma’s impeachment.

But how did this happen? How could the fortunes of an emerging power like Brazil, a member of the BRIC bloc, and a country that until a few months ago was the darling of many financial analysts and investors, have changed so quickly?

The seeds of Brazil’s current crisis were planted back in 2003, when then president-elect Lula took office. Despite being a former head of a worker’s union and leader of the very left-wing Worker’s Party, Lula opted to mostly stick to the orthodox economic policies of his predecessor, the center-left politician, Fernando Henrique Cardoso. These policies, known as the “tripod of stability” were centered on balanced budgets, free-floating currency exchange rates, and an independent central bank. Many credited these policies with ending a period of high inflation that had plagued Brazil for over 50 years.

One of the reasons Lula opted not to break from the policies implemented by his predecessor was the fact that most of his cabinet was composed of political pragmatists that followed the adage: “if it ain’t broken, don’t fix it”. Over time however, most of the original “pragmatists” in his cabinet had to resign from their posts due to accusations of corruption. Lula replaced them with hard-line old guard former communist guerrillas from the 1960s, and fellow union leaders, all whom openly despised the orthodox economic policies that had been in place until then. The “tripod of stability” was completely reversed. Government banks (BNDES, Caixa and Banco do Brasil) were ordered to give out low-interest loans to pretty much anyone, but especially to people with good government connections. One of such was magnate Eike Baptista, who borrowed billions from those banks while offering very little collateral as a guarantee, to invest in oil exploration, build semiconductor plants and bio-diesel plants.

The government also started injecting huge amounts of public money into the real estate market. The government implemented a policy in which any worker with a formal job would received a government backed loan of at least 100 thousand Reais (about US$30K at the time). As a consequence, overnight 100 thousand Reais became the floor price of any home, in any condition, anywhere in Brazil. A huge construction boom started, as massive amounts of government credit flooded the real estate market. Home prices sky rocketed and there was a shortage of construction workers, which pressured wages across the economy.

At the same time, control of the massive state-owned energy company, Petrobras, was handed to one of Lula’s union friends. He immediately put Petrobras’ vast financial resources to work on expensive projects of very questionable economic value, but with potential for huge political dividends. Such projects included a US $17 billion refinery in Lula’s home state. Many technical experts within Petrobras criticized the investment, saying that such a massive refinery was not needed, and even if it was, Lula’s poor and remote home state in the north was hardly the best place for such an endeavor. Those critics were quickly silenced and the project was placed on a fast track.

Other questionable investments conducted by Petrobras included the construction of a massive shipyard, also in Lula’s home state, and an acquisition of a refinery in Texas from a Belgian company for almost $900 million. Interestingly, that same refinery had been acquired by this Belgian company for $42 million only 4 years prior.

So, the stage was set for the tragedy that would follow. The artificial real estate boom gave Brazilian families a false sense of economic prosperity, as they watched the value of their homes triple or quadruple in just a few years. As a consequence, many of them went into deep consumer debt, trusting on the high value of their homes as backing. Magnate Eike Batista, who borrowed billions from government banks without any collateral, went bankrupt as most of his enterprises went nowhere, and the taxpayers were left holding the bag. Petrobras, as a consequence of the many new investments directed by the Lula’s cronies, became the most indebted energy company in the world ($179 billion). Most of its very bad investments tanked as multiple corruption scandals surfaced, where politically appointed Petrobras executives would demand bribes from suppliers and contractors. They pocketed part of the money, the other part went to the Worker’s Party campaign fund. So far, the police have uncovered more than US$800 million paid in bribes.

So, Brazil today is facing not only a nearly insolvent Petrobras, but state-owned banks sitting in hundreds of billions of dollars in bad loans. Having to rescue the banks, the government is facing one of the largest budget deficits in modern history. All companies suspected of paying bribes to Petrobras had all government contracts suspended pending an independent audit. This means that constructions of bridges, subways, power plants, and roads have all been put on hold. Two of those very large construction companies have gone out of business as consequence of the moratorium, which caused tens of thousands of construction workers to lose their jobs. As the bribery investigation continues, more construction companies are expected to fold.

Predictably, the government created real estate bubble has burst. Apartment buildings are sitting empty across the country. A large chunk of the population got into debt expecting the value of their “investments” to grow but now inflation is rising quickly and with it, the payments on their inflation-adjusted mortgages. Meanwhile, the value of their “investments” plummet. Overly leveraged home builders are sitting on unsustainable amounts of unsold real estate inventory. Many have folded, resulting in many more layoffs. The fear exists that this is just the tip of the iceberg, and that the police will now uncover similar corruption scandals in the state-owned banks and utility companies, which would escalate the crisis by an order of magnitude.

Despite all of the dark clouds in the Brazilian skies, there are positive signs that the institutions are working. The police are investigating, indicting and arresting people. The courts are convicting and sentencing them. The press is covering and investigating the events and publishing their findings. People on the streets are outraged and protesting. Looking at things from that angle, there are some positive actions taking place. One can also argue that the Lula/Dilma and the Worker’s Party experience ruling Brazil has brought a lot of political maturity to the country. Many citizens used to fantasize about the “heroes of the people” of the sixties and how those former Marxist guerrillas were idealists, pure hearted and really cared about the poor. Many think that their stint running the country has shattered that image, and showed to even most romantic and naive of their supporters how corrupt, ruthless and devious these people really are. These events in many ways are eradicating the last remnants of that old view of evil capitalists vs. good communists that still existed in Brazil.

Pedro M Calmon is a business development executive with extensive experience in Latin America. He attended the University Of Brasilia and has a MBA from Nicholls State University. He currently resides in the United States and works at Google Inc. The views presented in this article are his alone and do not necessarily represent the views of his employer.