BRASILIA (Reuters) - Brazil’s top electoral court dismissed a case on Friday that threatened to unseat President Michel Temer for alleged illegal campaign funding in the 2014 election, when he was the running mate of impeached President Dilma Rousseff.

Brazilian President Michel Temer attends the ceremony of 152th anniversary of the Riachuelo Naval Battle at the Marine Corps Headquarters in Brasilia, Brazil June 9, 2017. REUTERS/Ueslei Marcelino

The ruling gives Temer some breathing room but will not end a political crisis enveloping the beleaguered center-right leader. He is being investigated separately by federal prosecutors for corruption, obstruction of justice and racketeering.

“We cannot be changing the president of the Republic all the time, even if the people want to,” said the court’s chief judge, Gilmar Mendes.

Mendes, who backed the impeachment of Rousseff, said the country should not expect the court to solve the current political crisis.

The electoral court, known as the TSE, voted 4-3 to acquit the Rousseff-Temer ticket of wrongdoing. That avoided the annulment of their election and the removal of Temer from office. He took over a year ago following Rousseff’s impeachment in the midst of Brazil’s worst recession on record.

In a decisive move, that same majority had ruled on Thursday to not allow as evidence in the case plea-bargain testimony from 77 executives of the Odebrecht [ODBES.UL] construction firm, which is at the center of a vast political graft scheme.

Those witnesses told investigators they funneled millions of dollars in illegal funds into the 2014 Rousseff-Temer ticket. But the testimony was made more than a year after the beginning of the case that concluded Friday, and without it Temer’s lawyers argued there was no proof of wrongdoing.

The acquittal will help Temer, whose government’s poll ratings are in the single digits, retain key coalition allies who will support approval in Congress of his fiscal reform agenda. The austerity measures aim to bring a gaping budget deficit under control and restore investor confidence.

Alexandre Parola, a spokesman for Temer, said after the ruling that the president viewed the decision as an example of effective institutions keeping the country’s democracy working.

INVESTIGATIONS ‘JUST STARTING’

Political analysts said the acquittal was disastrous for the credibility of Brazil’s judiciary, the government institution that polls show is most trusted by Brazilians. Some warned it would add to growing disillusionment with democracy.

“This catastrophic ruling prolongs the survival of a government that has lost all credibility and can no longer govern,” said Roberto Romano, professor of ethics and political philosophy at Campinas University. He said it would add to a small but worrying trend of Brazilians favoring a return to military rule.

Temer, a third of his Cabinet and dozens of powerful congressmen are under investigation for corruption.

The leader is likely to soon face separate charges in the case involving allegations of receiving bribes and condoning the payment of hush money handed over to a potential witness in a massive graft scandal, investigators have told Reuters.

The Supreme Court approved the investigation into the president late last month.

But to put him on trial, the charges against the president would have to be approved by two-thirds of the lower chamber of Congress, where Temer’s coalition retains a majority.

With an election year approaching in 2018, however, the governing coalition’s majority could shrink if lawmakers break away, concerned about voters punishing them for being part of a government overwhelmingly perceived in polls as corrupt.

Slideshow ( 4 images )

Acquittal by the electoral court could help Temer’s main coalition ally, the Brazilian Social Democracy Party (PSDB), convince its younger members who want to bolt from the government to stay put and help push unpopular reforms through Congress.

But political volatility will not die down.

“The days ahead will be very difficult for Temer. The corruption investigations are just starting,” said Flavia Bahia, professor at the CERS law school and FGV think tank in Rio de Janeiro. “The government can’t be sure of its allies anymore.”

The separate investigation by prosecutors into Temer includes a secret recording of a conversation he had earlier this year with a former top executive of meatpacker JBS SA.

In it, the president appears to condone paying bribes to an imprisoned former lawmaker to keep him from turning state’s witness and providing potentially devastating testimony about graft.

Temer has denied any wrongdoing and insists he will never resign. But a one-time top aide to the leader, Rodrigo Rocha Loures, was caught on a police video released last month picking up a bag filled with 500,000 reais ($152,000) in cash from a JBS executive, allegedly meant to silence the potential witness.

Temer aides told Reuters they worry that if Rocha Loures decides to reach a plea-bargain deal with investigators, it will strengthen any charges filed against the president.