Brazil's President Michel Temer smiles as he receives military honors during ceremony, in Brasilia, Brazil, Friday, June 9, 2017. Brazil's top electoral court has decided to keep embattled President Temer in office. Judges on the Supreme Electoral Tribunal voted 4-3 against a suit about alleged campaign finance violations that would have annulled what was left of Temer's mandate. The decision is a much needed victory for Temer, who has faced growing calls that he resign amid a corruption scandal. (AP Photo/Eraldo Peres)

Brazil's President Michel Temer smiles as he receives military honors during ceremony, in Brasilia, Brazil, Friday, June 9, 2017. Brazil's top electoral court has decided to keep embattled President Temer in office. Judges on the Supreme Electoral Tribunal voted 4-3 against a suit about alleged campaign finance violations that would have annulled what was left of Temer's mandate. The decision is a much needed victory for Temer, who has faced growing calls that he resign amid a corruption scandal. (AP Photo/Eraldo Peres)

RIO DE JANEIRO (AP) — Brazil’s top electoral court gave embattled President Michel Temer a big victory late Friday, voting to reject allegations of campaign finance violations that could have removed him from office.

After four days of deliberations, judges voted 4-3 in a case that many viewed as a measure of whether Temer could remain in office amid a ballooning corruption scandal and single-digit popularity.

Last month, a recording emerged that apparently captured Temer endorsing hush money to ex-House Speaker Eduardo Cunha, a former Temer ally serving 15 years in prison for corruption and money laundering. Soon after that, details of another bombshell came out: that Temer was being investigated for allegedly receiving bribes.

ADVERTISEMENT

Temer has denied wrongdoing and vowed to stay in office.

“The facts are very serious, unbearable,” said Judge Luiz Fux, who voted to remove Temer, adding the campaign finance case was about “very serious crimes.”

Judge Gilmar Mendes, who has called Temer “a friend of many years,” cast the decisive vote to keep Temer in office. Mendes, also a justice on the Supreme Federal Tribunal, the country’s highest court, argued that electoral laws needed reform, suggesting that politicians should not pay the price for a broken system.

“The system needs stability. It is very easy to talk about morality, fighting against corruption. I want that too,” said Mendes, who in the past has come to the aid of other politicians facing legal trouble. “A president can’t just be replaced at any time, even if the desire is there.”

The campaign finance case was filed shortly after the 2014 presidential election by one of the losing parties. It alleged that the ticket of President Dilma Rousseff and running mate Temer, then the vice presidential candidate, gained an unfair advantage through illegal campaign contributions. Temer took over the presidency last year after Rousseff was impeached and removed for illegally managing the federal budget.

The campaign finance allegations were bolstered in recent months by stunning testimony from plea bargains signed by current and former executives at the construction giant Odebrecht, a company at the center of a colossal investigation into billions of dollars in inflated contracts and kickbacks to politicians. The executives provided shocking details of tens of millions of dollars in bribes and illegal campaign contributions, including to the Rousseff-Temer ticket.

ADVERTISEMENT

In their deliberations, the judges argued about whether those plea bargains should be considered in their decision. They also clashed over the strength of the original evidence and whether punishments should be doled out when illegal campaign finance was widespread.

A guilty verdict would have annulled the 2014 victory, thus stripping Temer of the rest of his mandate. It could also have stripped both Rousseff and Temer of political rights for eight years.

While Temer had vowed to appeal a conviction, it would have weakened his hand in a climate of several corruption scandals and a public furious about it.

“Temer will stay in office and probably face many demonstrations in the streets,” said Alexandre Barros, a political risk consultant with the Brasilia-based firm Early Warning. “I don’t think anybody is in the mood to decide something unexpected at this point.”

The political turmoil in Brazil — that began with the push last year to remove Rousseff from power for violating budget laws — has reached a fever pitch. There are near weekly protests calling for Temer’s ouster, frequent shouting matches in Congress, and a simmering debate in the media over whether Temer will manage to finish out his term.

That atmosphere was reflected in the courtroom, where there were several tense moments.

Among the most dramatic came during the opening of the afternoon session Friday, when a prosecutor requested the disqualification of one of the judges who had once been a lawyer for Rousseff and one justice decried articles in the press that linked him to a corruption investigation. As the tension in the chamber rose, the court’s president called a brief break.

While Temer has survived another day, the future will be difficult. His already very low popularity has plunged further amid the corruption allegations. A Temer ally and former congressman, captured on video by federal police carrying a suitcase full of bribe money, was recently jailed — and any testimony he provides could further implicate Temer.

The main parties in Temer’s coalition have stuck with him so far, but several reports have reflected worry that being associated with his could be detrimental to re-election campaigns next year.

Ironically, Temer’s strongest argument to stay in power is that he can deliver major reforms to labor laws and the country’s pension system. While deeply unpopular among Brazilians, many economists have argued they are necessary to help pull Latin America’s largest nation from recession and many members of Congress want them passed, if anything to be able to point at something besides widespread corruption.

“Temer will argue, ’I’m the guy who is going to give the country the bitter remedy that will cure it,” said Carlos Manhanelli, political marketing specialist and chairman of the Brazilian Association of Political Consultants.

____

Associated Press reporter Sarah DiLorenzo contributed to this report from Sao Paulo.

___

Follow Peter Prengaman at twitter.com/peterprengaman

Follow Mauricio Savarese at twitter.com/MSavarese

Follow Sarah DiLorenzo at twitter.com/sdilorenzo