When a measure to impeach Brazilian President Dilma Rousseff was introduced to Congress late last year, the possibility that she would actually be removed from office seemed remote.

The charges against her were obscure, not the variety that spurs outrage: She is alleged to have broken fiscal rules in her handling of the federal budget to hide deficits and bolster an embattled government. The allegations also came with a good dose of irony: Her main opponents in Congress are accused of crimes much worse.

Yet, what started as a long shot bid has gained momentum and, as the Senate prepares to vote Wednesday on whether to put her on trial, many analysts consider Rousseff's ouster all but a foregone conclusion.

"Dilma will be impeached for a variety of reasons," said Marcos Troyjo, a professor at Columbia University's School of International and Public Affairs. "And the possibility of her coming back is zero."

If a simple majority of the Senate's 81 members vote to take up the impeachment measure, Rousseff will be suspended from office while a trial is conducted within the next 180 days. In the interim, Vice President Michel Temer will take over. A conviction, requiring a two-thirds vote, would remove her permanently.

Brazilian newspapers' polling of senators has found that around 50, many more than necessary, plan to vote for a trial. But it's not clear that all of those would also vote to convict her. A tally by the newspaper Folha de S.Paulo suggests that so far only 41 senators are willing to remove Rousseff from office permanently — 13 short of the number needed.

The expected Senate action comes after the lower Chamber of Deputies voted 367-137 last month in favor of impeachment, an anti-Rousseff verdict so resounding that many Brazilians believe it will influence the Senate, where she has traditionally been seen to have more allies.

Rousseff has repeatedly called the impeachment drive a "coup" because she has not been charged with a crime. She argues that previous presidents used similar accounting practices.

Despite being the legal basis for the case against her, however, impeachment has turned into a referendum on Rousseff's leadership. Brazil is beset by a bevy of corruption scandals connected to her Worker's Party and is struggling with its worst recession since the 1930s. The president also is criticized for an inability to negotiate with other politicians in a country where personal relationships are paramount.

Rousseff, a former Marxist guerrilla group member who became an establishment insider, rode the coattails of her once wildly popular mentor and predecessor as president, Luiz Inacio Lula da Silva, to win the presidency in 2010. Things were fine as the region's largest economy roared, and in 2014 she was re-elected with 51 percent of the vote.

But at the same time that prices for commodities that are the lifeblood of Brazil's emerging economy started tumbling, investigators began uncovering a multibillion-dollar kickback scheme at Petrobras, the state oil company. Worst of all for Rousseff, many of the people implicated are top officials in her party. The continuing probe has led to the conviction of dozens of the country's elite, from politicians to the former president of Obredecht, a major construction firm.

While Rousseff hasn't been accused of wrongdoing, many Brazilians hold her accountable because much of the alleged corruption happened during her administrations and those of Silva. The popularity of both has plunged.

Rousseff was chief of staff during Silva's second term and before that she was minister of mines and energy, positions where she was in a position to know about the widespread graft at Petrobras, her critics say.

"The people involved abused and took advantage of the opportunity to steal money in an absurd way," said Tiago Gomes da Silva, a 33-year-old standing in line at an unemployment office in Rio de Janeiro. "This had to come to an end. And the actual government is directly linked to this."

As details of the corruption have emerged the last two years, the economy has continued downward. Gross domestic product is expected to contract 3.6 percent this year after an equally bad 2015. Both inflation and unemployment are around 10 percent and announcements of closures, from local factories to multinational chains like Wal-Mart, have become commonplace.

"The problem in Brazil was the inflation," Carlos Antonio Porto Goncalves, economics professor at the Getulio Vargas Foundation, said of Rousseff's first years as president. "And the government, to fight inflation, raised interest rates to extremely high levels so demand decreased, and the recession came."

Mixed into it all has been Rousseff's inability to work with others. She is known for bluntness, and she doesn't have the charisma or back-slapping chumminess that analysts say is often necessary to build consensus and make deals.

"She is a woman with a knife in her boot," said Alexandre Barros, a political consultant in Brasilia, using a popular phrase in Portuguese to describe tough women. "But she is not a politician."

___

Associated Press video journalist Renata Brito reported this story from Rio de Janeiro and AP writer Peter Prengaman reported from Buenos Aires, Argentina.

___

Peter Prengaman on Twitter: http://twitter.com/peterprengaman