BRASILIA (Reuters) - Brazil’s Supreme Court rejected a last-ditch attempt by President Dilma Rousseff to avert an impeachment vote in Congress on Friday, further reducing her chances of survival as a new poll showed her short of crucial support from lawmakers.

Brazil's President Dilma Rousseff rides her bicycle near the Alvorada Palace in Brasilia, Brazil April 15, 2016. REUTERS/Ueslei Marcelino

Rousseff’s attorney general, Jose Eduardo Cardozo, had asked the top court for an injunction to suspend Sunday’s lower house vote until the full court can rule on what he called procedural flaws in the impeachment process.

But the court dismissed the motion 8-2 during a session that ran into the early hours.

Before the decision, a new survey by the Estado de S.Paulo newspaper showed for the first time that Rousseff’s opponents had already secured the 342 lower house votes needed to advance impeachment.

Rousseff, an unpopular leader already struggling with Brazil’s worst economic crisis in decades and a spiraling corruption scandal, has seen support from within her governing coalition steadily erode.

If her impeachment is approved by the required two-thirds majority of 513 house members, the Senate must then vote on whether to go ahead with putting Rousseff on trial for breaking budget laws.

That could clear the way for Rousseff’s suspension and replacement by Vice President Michel Temer as soon as early May, pending a trial that could last six months.

Rousseff, a former leftist guerrilla, had not been expected to resort to the Supreme Court until after Sunday’s vote. Cardozo’s request to the court was seen as a sign, even before the latest newspaper survey, that her government now expects defeat.

Slideshow ( 10 images )

CONTINUED POLITICAL TURMOIL

Vowing to fight to the end, Rousseff met with her political advisers as her government scrambled for votes to block impeachment, but defections by several centrist allies in her coalition have seriously compromised that effort.

Brazil’s largest political party, the president’s main coalition partner until it broke away two weeks ago, said most of its members in the lower house will back deposing her.

Leonardo Picciani, the lower chamber leader for the party, the Brazilian Democratic Movement Party, or PMDB, told reporters that 90 percent of the 68 members of his caucus would vote for impeachment.

If Rousseff is ousted, it would end the 13-year rule of her leftist Workers’ Party, which has lifted millions of Brazilians out of poverty and is overwhelmingly supported by the poor.

Rousseff is not being investigated in the massive graft scandal surrounding state-run oil company Petrobras that has reached into her inner circle. She denies she broke budget laws, but opponents allege that accounting tricks helped her win re-election in 2014 by boosting public spending.

Temer, who would serve out Rousseff’s term until 2018 if she is ousted by the Senate, has little popular support. He would face a daunting task restoring confidence in a country where dozens of political leaders, including close associates of his, are under investigation for corruption.

Rousseff’s Workers’ Party warned on Thursday that chaos will take hold of Brazil, Latin America’s largest economy, if its democratically elected president is deposed.

“It’s a mistake to think that overthrowing a government will bring stability, peace, security and development,” the party’s leader, Rui Falcao, told reporters in Brasilia. “Not respecting the popular vote will plunge the country into chaos.”

Cardozo, Rousseff’s former justice minister and the government’s main legal adviser, has said previously that the impeachment process was unconstitutional. In his appeal to the Supreme Court on Thursday, he asked it to annul the report to the lower house by a congressional committee that recommended impeachment on Monday.

He told a news conference Rousseff’s defense had been obstructed in the committee and that testimony from a former ally of the president, Senator Delcidio Amaral, was obtained as part of a plea bargain deal and should have been considered inadmissible.