Court favours Temer in campaign finance case, but the embattled president still faces a separate corruption probe.

Brazil’s embattled President Michel Temer has been cleared of charges that he received illegal campaign funds in a 2014 election, a ruling that allows him to stay in office.

The country’s top electoral court, known as the TSE, voted 4-3 on Friday to acquit Temer of accepting illegal contributions when he was the running mate of impeached President Dilma Rousseff in three years ago.

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

“We cannot be changing the president of the republic all the time, even if the people want to,” Gilmar Mendes, TSE chief judge, said on Friday.

“There are serious proven facts but not enough to annul the mandate.”

OPINION: What next for Brazil’s decaying kleptocracy?

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

The verdict avoided the annulment of the Rousseff-Temer 2014 election victory and the removal of the president from office.

Temer took office last year, promising a “new era” for Brazil following Rousseff’s impeachment over accusations of taking illegal state loans to patch budget holes in 2014.

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

Those witnesses told investigators they funnelled 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, 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 amid a worsening economic situation.

The controversial 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’

Attention will now turn to Temer’s battle against the parallel case in which he is accused of obstruction of justice and corruption.

The president refused an order by prosecutors of the obstruction case to provide a written deposition by Friday. Temer demanded instead that the probe against him be shut down.

Prosecutor General Rodrigo Janot alleges that Temer agreed to payments of hush money to Eduardo Cunha, former lower house of congress speaker, who is in prison for corruption.

Janot had ordered Temer to answer 82 questions in writing by late Friday as part of his building of the case. Rather than meet the deadline, Temer’s lawyers branded the probe a “comedy”, an “inquisition” and “arrogant”.

OPINION: There is no justice for the poor in Brazil

Temer says the central piece of evidence in Janot’s probe – a secretly-made audio recording of a conversation he had with a meatpacking industry tycoon – was doctored.

But analysts say Janot could soon move from the current investigation to requesting formal charges.

“The days ahead will be very difficult for Temer. The corruption investigations are just starting,” Flavia Bahia, professor at the CERS law school, told the Reuters news agency.

“The government can’t be sure of its allies any more.”

Under the constitution, the lower house would have to approve any charges by a two-thirds majority before a trial could start in the Supreme Court.

UPFRONT: Brazil’s Dilma on being betrayed

That approval process in congress could be lengthy and Temer is working daily to maintain enough support among legislators to defeat any eventual charges.

Temer has faced months of anti-government protests over his fiscal reforms and ongoing corruption investigations, with many calling for his resignation.

The president has continually denied any wrongdoing and insists he will never resign.