A supporter of Brazilian President Dilma Rousseff waves the national flag and the flag of the Rousseff’s Workers’ Party outside Planalto Palace, the president’s official workplace, in Brasilia on May 10, 2016. Rousseff faces an impeachment vote in the Senate. (Fernando Bizerra Jr./European Pressphoto Agency)

Breaking News: Brazil’s president impeached and suspended from office.

President Dilma Rousseff’s chances of remaining in office were slipping away Wednesday as senators prepared an impeachment vote to suspend her and put the once-popular leader on trial for allegedly breaking budget laws.

Rousseff’s removal would be a stunning blow to her leftist Workers’ Party, which presided over years of prosperity and robust social-welfare spending that lifted more than 30 million Brazilians out of poverty. Now Rousseff and her party are paying for Brazil’s crash.

With the opening ceremony of the Olympic Games in Rio de Janeiro less than three months away, South America’s largest country is facing its most severe economic contraction since the 1930s, and a massive corruption scandal has tarnished nearly all of Brazil’s political leaders.

The impeachment vote is the culmination of months of legal and political maneuvering by Rousseff’s administration and its opponents, a process that has produced a gripping drama that has left Brazilians frustrated and increasingly worried that their country is sliding into long-term dysfunction.

Brazilians followed Wednesday’s Senate proceedings closely, with TV networks providing live coverage and news sites offering a running tally of the senators denouncing Rousseff. Many of the lawmakers described her impeachment as the essential first step toward turning the country around.

“The big day has arrived. Today this house, the federal Senate, will give the Brazilian people their country back,” said Sen. Ataídes Oliveira.

Rousseff, 68, a former Marxist guerrilla who became Brazil’s first female president, is one of the few top political figures not under suspicion of bribe-taking or other corruption, although her party is accused of involvement in dirty deals. That difference had emboldened Rousseff’s defenders and raised doubts among international observers about the legitimacy of the impeachment effort. Some independent analysts and Rousseff allies called the proceedings an excuse to get rid of an unpopular leader, and a sign of political immaturity in a country whose democracy was restored in 1985 after two decades of military rule.

“We are living a shameful and historic moment,” said Sen. Telmário Mota, one of the few lawmakers to defend Rousseff.

He called the impeachment push a lack of respect for democracy. “The democratic vote at this moment is being taken from millions and millions of electors,” he said, referring to the 54 million voters who backed Rousseff’s reelection in 2014.

The Senate’s vote was scheduled for Wednesday evening, but the session continued into the night, with dozens of lawmakers lined up to speak.

Rousseff would be forced to step down if a simple majority of Brazil’s 81 senators voted to impeach her. Senators would then have 180 days to conduct hearings ahead of a final vote to determine her fate. Vice President Michel Temer would assume the presidency on an interim basis, and he would serve out the rest of Rous­seff’s term if she was found guilty.

A loss in Wednesday’s vote would put Rousseff among a small number of democratically elected leaders who have been impeached. They include former U.S. president Bill Clinton, who was impeached in the House in 1998 but acquitted in a Senate trial.

The procedure is not unfamiliar to Brazilians. In 1992, then-President Fernando Collor de Mello resigned after he was put on trial by the Senate on corruption charges. He later returned to politics and won a Senate seat. On Wednesday, he said Rousseff’s government was “in ruins.”

According to unofficial tallies by Brazilian news media, at least 50 senators have stated that they are in favor of her impeachment. On the floor of the Senate on Wednesday night, the debate neared its halfway point, and 28 of 36 senators had spoken in favor of impeachment.

Rousseff is accused of improperly using billions of dollars in loans from government banks to patch budget gaps and fund popular social programs. Senators must decide whether this amounts to a “crime of responsibility” under Brazilian law.

Rousseff’s opponents say she deceived lawmakers and the public about the state of the country’s finances to conceal her mismanagement of the economy. She denies any wrongdoing and insists that her predecessors used the same bookkeeping procedures.

A two-thirds majority of the Senate will be needed to permanently unseat her. If at least 54 senators vote for impeachment, it will be widely taken as a sign that her presidency is finished.

One Rousseff opponent compared her presidency to “gangrene” sickening Brazil. “If we amputate the leg, we save the body,” Sen. Magno Malta said.

Anti-impeachment demonstrators on Wednesday blocked roads with burning tires in cities including Sao Paulo and the capital, Brasilia, where police fired tear gas and clashed with a small group of protesters.

But Rousseff’s support base has withered, and a climate of resignation has settled over her administration and the Workers’ Party, with some supporters conceding that Wednesday was likely to be her last day in office.

Rousseff was not waiting for the vote either: She ordered her photos, books and other belongings packed up at the presidential office Wednesday afternoon in anticipation of her suspension, according to Brazilian news reports.

She was expected to hold a news conference Thursday morning and release an online video, but there was no indication that she was preparing to resign.

Rousseff narrowly won reelection in 2014, but recent polls show that her approval rating has slumped to about 10 percent. Critics say her brusque personal style and distain for retail politics added to her isolation by turning onetime allies against her. She made no speeches or public statements Wednesday and was ­photographed strolling through the grounds of the presidential palace in exercise clothing, among long-necked rheas — large, flightless birds native to South America.

Some prominent international observers have cautioned that Rousseff’s removal could set a bad precedent for democracy by promoting the idea that a presidential mandate from voters can be interrupted by lawmakers.

Luis Almagro, the secretary general of the Organization of American States, has questioned the legality of Rousseff’s possible removal, but he said he would seek the opinion of the Inter-American Court of Human Rights before drawing any conclusions. At the Vatican, Pope Francis — the first Latin American pontiff — expressed hope that Brazilians will unite after this “time of difficulty.”

On Wednesday, a justice on Brazil’s Supreme Court denied Rousseff’s last-ditch appeal to stop the proceedings. Attorney General José Cardozo, who is defending Rousseff, said he would file fresh appeals to the Supreme Court.

Rousseff has vowed to fight on. She and the Workers’ Party have rallied supporters by painting the effort to oust her as a “coup” that drags Brazil back to the dark era of authoritarian rule. Rousseff was jailed and tortured by the military dictatorship for her activities as a leftist militant.

Her opponents were so confident of the outcome Wednesday that the leader of the Senate told reporters that Rousseff would be served her suspension notice Thursday, even though the vote to impeach her was still hours away.

Last month, Brazil’s lower house voted 367 to 137 to impeach Rousseff. The interim speaker of the Chamber of Deputies stunned the country Monday by trying to annul that vote, but he changed his mind less than 24 hours later, clearing a path for the Senate vote.

Brian Murphy in Washington contributed to this report.