BRASILIA, Brazil — Brazil’s Senate voted Thursday to impeach President Dilma Rousseff after a months-long fight that laid bare the country’s fury over corruption and economic decay, hurling Latin America’s largest country into political turmoil just months before it hosts the Summer Olympics.

Rousseff called the move a coup d’etat and her backers threatened wide-scale protests and strikes. Her foes, meanwhile, insisted that she had broken the law, and that the country’s deep political, social and economic woes could only be tackled without her.

The 55-22 vote means that Rousseff’s ally-turned-enemy, Vice President Michel Temer, will take over as acting president Thursday while she is suspended. The Senate has 180 days to conduct a trial and decide whether Rousseff should be permanently removed from office.

“Did anyone think that we would get to 2018 with a recovery under this government? Impossible,” said Jose Serra, the opposition Social Democratic Party’s failed presidential candidate in the 2010 race that brought Rousseff into power. “The impeachment is just the start of the reconstruction.”

Rousseff, 68, was impeached for allegedly using illegal accounting tricks that critics said were meant to hide ballooning deficits and bolster an embattled government.

Brazil’s first female president, who was tortured under the country’s dictatorship, has frequently blasted the impeachment push as modern-day coup, arguing she had not been charged with a crime and previous presidents did similar things.

Addressing the nation hours after the vote, Rousseff vowed to keep fighting. She said she has gone through the pain of torture, as a guerrilla during the dictatorship, as well as illness as a cancer survivor, but that no pain was as acute as that of the injustice of the impeachment.

“I may have committed errors but I never committed crimes,” she said, at one point choking up. “It’s the most brutal of things that can happen to a human being to be condemned for a crime you didn’t commit. There is no more devastating injustice.”

Rousseff has also previously suggested that sexism in the male-dominated Congress played a role in the impeachment.

Rousseff’s suspension and likely permanent removal ends 13 years of rule by the left-leaning Workers’ Party, which is credited with lifting millions out of abject poverty but vilified for being at the wheel when billions were siphoned from the state oil company Petrobras.

Analysts also say Rousseff got herself into trouble with a prickly manner and a perceived reticence to work with legislators that may have alienated possible allies.

Temer, a 75-year-old career politician, has promised to cut spending and privatize many sectors controlled by the state. For weeks, he has been quietly putting together a new Cabinet, angering Rousseff supporters. The lower house voted 367-137 last month in favor of impeachment.

The marathon debate in the Senate began Wednesday morning and took 20 hours as dozens of lawmakers rose to give their opinions.

Humberto Costa, the Workers’ Party leader in the Senate, brandished a photo of Rousseff from her days as a young Marxist guerrilla during the country’s 1964-1985 dictatorship at the military proceedings against her.

Costa called Thursday’s impeachment the second unjust trial Rousseff had endured, saying it was a bid by Brazil’s traditional ruling classes to reassert their power and roll back Workers’ Party policies in favor of the poor.

“The Brazilian elite, the ruling class, which keeps treating this county as if it was their hereditary dominion, does not appreciate democracy,” Costa said.

When the impeachment measure was introduced last year in Congress, it was generally viewed as a longshot. As late as February, experts were predicting it wouldn’t even make it out of committee in the lower Chamber of Deputies.

But the momentum built as Brazilians seethed over numerous corruption scandals linked to Petrobras and daily announcements of job losses added to a growing desperation. The Brazilian economy is expected to contract nearly 4 percent after an equally dismal 2015 and inflation and unemployment are hovering around 10 percent, underscoring a sharp decline after the South American giant enjoyed stellar growth for more than a decade.

Polls have said a majority of Brazilians supported impeaching Rousseff, though they also suggest the public is wary about those in the line of succession to take her place.

“Dilma is a bad president and waiting until 2018 was a horrible option,” said cab driver Alessandro Novais in Rio de Janeiro, minutes after the vote. “I don’t think Temer will be much better, but at least we can try something different to overcome the crisis.”

Temer has been implicated in the Petrobras corruption scheme as has Renan Calheiros, the Senate head who is now No. 2 in the line of succession. Former House Speaker Eduardo Cunha, who had been second in line, was suspended from office this month over allegations of obstruction of justice and corruption.

Rousseff has vehemently denied her administration’s budget moves constituted a crime and argued that such maneuvers were used by prior presidents without repercussions. She has stressed that — unlike many of those who have pushed for impeachment — she does not face any allegations of personal corruption.

“I think Brazil went backward in institutional maturity,” said Tiago Cordeiro, digital media consultant. “I am shocked to see how people find it OK to oust a president without reason.”

While the trial is conducted, Rousseff will remain in Alvorada Palace, the presidential residence, Calheiros said. Rousseff will have security guards, health care, and the right to air and ground travel, as well as staff for her personal office and a salary, said Calheiros, who declined to say what it would be.

Temer, of the centrist Democratic Movement Party, insists he would expand the popular social programs, though he has also signaled that fiscal rigor is needed to dig Brazil out of its current financial hole.

The investigation into a multibillion-dollar kickback scheme at Petrobras has ensnared dozens of elite politicians and businessmen across the political spectrum. Although Rousseff herself hasn’t been implicated, top officials in her party were and that tarnished her reputation.

The president “is having to pay for everything,” Sen. Telmario Mota de Oliveira said.