Michel Temer: Court rules in favour of Brazil leader Published duration 10 June 2017

image copyright EPA image caption Mr Temer's approval rating has dropped amid accusations

Brazil's President Michel Temer has been acquitted of irregularities in the 2014 election, a ruling which allows him to stay in office.

By four votes to three, the Superior Electoral Court rejected claims that illegal money was used in the campaign.

If found guilty, Mr Temer could have been forced out of the presidency.

The accusations referred to the vote won by Dilma Rousseff with Mr Temer as her running mate. He replaced her when she was impeached last year.

What were the accusations?

The court looked at whether the Rousseff-Temer presidential campaign in 2014 should have been invalidated because of illegal campaign donations.

Judge Herman Benjamin, the investigator in the case, voted for their conviction, saying that a system of undeclared donations and bribes favoured them in the election.

He said they were both guilty of abuse of economic and political power

"This is enough to invalidate the mandate," he said at the session broadcast live on TV.

But four other judges voted against him, some saying that the evidence presented was not enough to prove that the illegal money that went to the political parties was used in the campaign.

image copyright Reuters image caption Rousseff was impeached accused of illegally moving funds between government budgets

If they had been convicted, Mr Temer could have been suspended from the presidency while Ms Rousseff would have lost her political rights.

What happens next?

This ruling is hardly going to clear up Brazil's messy politics, it just kicks the ball down the road, says the BBC's Katy Watson. Mr Temer has little support among the electorate, and he is clinging on to political support - for now, says our correspondent.

Brazilian politics has been in a state of crisis for some time now, in part fuelled by the country's largest-ever corruption investigation.

Known as Operation Car Wash , the inquiry - which started in March 2014 - has implicated some of Brazil's biggest names, and a third of the cabinet are under investigation for corruption.

Then last month, leaked audio recordings surfaced that seemed to show Mr Temer encouraging the payment of hush money to Eduardo Cunha, the former lower house speaker who led the impeachment process against Ms Rousseff.

The recording led to calls for Mr Temer to step down, but he has refused to go, despite being abandoned by some allies and powerful media outlets.

media caption Footage showed rubber bullets and tear gas being used against some demonstrators

The president is very unpopular, with approval ratings in the single digits. But among the political and business elite he was tolerated, partly because he was trying to push through pension and labour reforms which, they say, were vital to revive the country's economy.

Brazil finally emerged out of recession in the first quarter of this year, after two years of negative growth, and Mr Temer said he was the only one capable of bringing the stability needed for full economic recovery.

If Temer goes, who comes in?

President Temer is being investigated for other allegations of corruption.

If he were to be charged, then that is where the political calculations come in.

According to the Brazilian constitution, if there are fewer than two years left in a term, Congress will choose a caretaker president to govern until the next elections, due in 2018.

image copyright Reuters image caption "Out Temer": despite pressure to resign, the president says he is not going anywhere

But nobody really knows the rules of this kind of election because it has never happened before. That would likely bring further uncertainty, analysts said.

Many want direct elections so they can choose a new leader rather than have it chosen by a Congress that is seen as part of the problem.