It was just what Brazil needed.

With a vast corruption scandal in full swing, an economy in free fall, public finances in tatters — and a self-serving political class in no mood to tackle any of it — the country has now been served a constitutional crisis.

On Dec. 2, Eduardo Cunha, Speaker of Congress' lower house, initiated impeachment proceedings against the president, Dilma Rousseff. "I take no pleasure in this act," Cunha told a news conference, stressing that his decision was of a purely "technical nature."

Its consequences will be anything but.

The arguments that apparently won Cunha over had been laid out by three respected lawyers, including Hélio Bicudo, a champion of human rights and former member of Rousseff's left-wing Workers' Party (PT), which he helped found. The trio's main allegation is that by failing on time to stump up cash to state-owned banks paying welfare handouts on its behalf, the administration let itself be funded by entities under its control. This practice is barred by the fiscal responsibility law. Yet it occurred in 2014, the accusers claim, and, critically, also this year.

Cunha had thrown out Bicudo's earlier motion because it referred only to Rousseff's first term in 2011-14, agreeing with most jurists that a sitting president can only be pursued for actions committed in the current term in office.

For all his protestations to the contrary, few doubt that Cunha's motives were not technical but political — possibly even personal. The speaker, whose Party of the Brazilian Democratic Movement (PMDB) belongs to the governing coalition, is one of 34 sitting congressmen under investigation over alleged involvement in the bribery scandal centered on Petrobras, the state-controlled oil-and-gas giant.

Prosecutors allege that in exchange for padded contracts, Brazil's biggest construction firms paid more than a billion dollars in bribes to Petrobras directors, who in turn funneled the money to their political masters.

Around 140 businessmen, including some of Brazil's richest men, have been charged with crimes such as bribery and money laundering. On Nov. 25, police arrested a prominent PT senator, Delcídio do Amaral, for allegedly attempting to spirit a former Petrobras director out of the country before he could cooperate with the authorities.

Many think Cunha could be next. His name has cropped up repeatedly in the context of the affair. On Nov. 30, it did so again, when a leak from the investigation suggested that he had received $12 million from BTG Pactual, an investment bank, in exchange for favorable legislation. BTG's billionaire founder, André Esteves, was also arrested for plotting with Do Amaral. Both men, as well as BTG, deny wrongdoing.

Cunha, too, continues to protest his innocence. But evidence against him has been piling up. This week the lower-house ethics committee was expected to recommend ousting the speaker from the legislature for hiding Swiss bank accounts. After much dithering, PT deputies signaled they would cast their deciding votes against the speaker, in line with public opinion but against the quiet wishes of the presidential palace, which feared that Cunha would drop the impeachment bombshell to divert attention from his own travails.

The process now takes on a life of its own. Within a month, deputies must decide whether to pass the case to the senate, which requires a two-thirds majority. Senators would then have 180 days to try the president, during which time she would be suspended from her duties. The vice president, Michel Temer, would take over.

Rousseff, too, has an economic disaster on her hands, largely the result of irresponsible fiscal and monetary policies and incessant microeconomic interventionism in her first term. Figures released this week show that GDP shrank for the third consecutive quarter between July and September. It was 4.5 percent lower than in the same period last year; 2016 will mark the second year of recession — the longest downturn since the 1930s. Inflation was around 10 percent in November and unemployment is rising. Alberto Ramos of Goldman Sachs, an investment bank, speaks of an "outright depression."

Rousseff appears finally to have grasped that budgetary belt-tightening is the first step to recovery. But, like former President Fernando Collor, she lacks the skill to negotiate Brasília's fragmented political landscape. Her approval rating, sapped by the Petrobras scandal and the deteriorating economy, is around 10 percent, roughly where Collor's was at his 1992 impeachment.

Here, though, the similarities between her and her disgraced predecessor-but-three end. Unlike him, Rousseff has not been accused of enriching herself. And she retains the backing of the PT, which has not lost all its strength.

Perhaps most important, there is little evidence that the opposition wants to take the mess off Rousseff's hands. It would rather watch her suffer and win an easy victory in the next election in 2018. The PMBD — led by Temer, who would become president in case of her departure — might accept it, but probably only if it could count on the pork and patronage that have historically been the party's main objective.

Ironically, Cunha's move to impeachment may have made Rousseff's survival until 2018 more likely rather than less. The timing works in her favor. Cunha can easily be painted as self-serving rather than statesmanlike, putting a question mark over the whole rigmarole. The PT is likely to close ranks in support of its president. And Rousseff will no doubt be more adamant than ever that she is not stepping down of her own accord, as some in the opposition had been hoping. Responding calmly to Cunha, she spoke of her "indignation."

Sadly, the furor will divert Brazilian politicians' already scattered attention away from fixing the country's many problems, starting with the ballooning budget deficit. History may judge this to be Cunha's greatest sin.

Copyright 2013 The Economist Newspaper Limited, London. All Rights Reserved. Reprinted with permission.