By Anthony Boadle
BRASILIA (Reuters) - Brazilian President Michel Temer personally intervened behind the scenes to defuse a clash between the Supreme Court and the Senate this week in an effort to ensure the passage of flagship spending cuts that have revived investor confidence.
Yet the compromise the former congressman helped stitch together may further undermine the scandal-plagued political establishment's credibility in the eyes of Brazilians frustrated by corruption and a two-year recession, critics said.
Aides said Temer had been preparing to brief labor leaders about planned austerity measures on Monday when he learned that a Supreme Court justice had issued an injunction removing Senate President Renan Calheiros because of his recent indictment for embezzlement.
The political crisis deepened when Calheiros refused to step aside and appealed to the full court.
Presidential staff rushed to confirm the news amid fears that leadership of the Senate would pass to its vice president, Jorge Viana, whose leftist Workers Party opposes belt-tightening and wants to delay or block a vote on Tuesday on the 20-year cap on public spending.
"We were worried because we knew the Workers Party would put pressure on Viana to delay the vote," a senior Temer aide said.
Presidential advisers envisaged a plunge in the nation's currency and stock markets as capital would flee the country if the spending ceiling is not approved as planned.
Instead Temer, who had been a three-time speaker of the lower house of Congress, worked the phones to Chief Justice Carmen Lucia Rocha and other judges. "He called them to try to calm things down," the aide said.
Temer also sent his justice minister to the court to look for a way out of the crisis and had leaders of his PMDB party speak to Viana, who helped broker a deal with the justices.
The government's argument that removing Calheiros would plunge the economy deeper into recession convinced a majority of the justices, who ruled he could stay but must be removed from the presidential line of succession due to his indictment.
The pact has kept the spending cap vote on track but was a new blow to the reputation of political institutions that have been rocked by a massive corruption scandal centered on state-run oil company Petrobras.
Dozens of politicians are under investigation for receiving kickbacks, including Calheiros, who was indicted last week in a case involving child support for a daughter he had out of wedlock.
The deal over Calheiros weakens the Supreme Court at a time when Brazilians were looking to its justices to clean up the political establishment.
"Our credibility has hit rock bottom," said Senator Cristovao Buarque, a member of the ruling coalition. He criticized Calheiros for setting a bad example to the nation by disobeying a Supreme Court injunction.
"The question is how much longer the political class can continue making mistakes before the people invade Congress or take to the streets to ask the military to take power again," Buarque said by telephone.
In a year of political turmoil in Brazil, Calheiros' defiance of the Supreme Court followed the removal and jailing of the former speaker of the lower house for corruption and the impeachment of former President Dilma Rousseff.
"Brazil was a promising young democracy not long ago," said Brasilia columnist Tereza Cruvinel. "Now it looks more like banana republic."
(Reporting by Anthony Boadle; Editing by Lisa Von Ahn)