Brazils Supreme Court Wednesday overruled a bid to suspend the powerful Senate speaker from his position as he faces trial for alleged embezzlement, offering some relief to the scandal-hit government.
The court's judges voted to let Renan Calheiros, 61, remain in his post but stripped him of his status as third in line after the president, on grounds that he faces corruption charges -- which he denies.
An earlier ruling by one of the judges, Marco Aurelio Mello, had threatened to disrupt President Michel Temer's efforts to push a sensitive public spending cap through the legislature.
The full board of judges voted by six to three to overturn that ruling.
They also ruled that Calheiros must be stripped of the constitutional role that would see him become the country's replacement president in the event that Temer or his number two, the speaker of the lower house, could not perform the task.
Calling the decision "patriotic," Calheiros said in a statement that "confidence in Brazilian justice and the separation of powers remains immovable."
Calheiros is considered Temer's most powerful ally.
Together they led impeachment procedures which ended in Temer's predecessor, Dilma Rousseff, being removed from office in August.
Now Temer is tasked with lifting Latin America's biggest economy out of crisis.
Following Wednesday's ruling, Calheiros will be able to preside over a Senate session next Tuesday, when the decisive vote on Temer's spending cap is scheduled.
The court last week ordered Calheiros to face trial on embezzlement charges. He has denied accusations he used public money to make support payments to a woman with whom he had a child.
In a separate case, Calheiros is among numerous top politicians including an ex-president and lawmakers accused of helping steal billions from the state oil firm Petrobras.
Calheiros had tried unsuccessfully last week to push through an urgent reform that would challenge judges' powers to investigate corruption.
Prosecutors threatened to resign in response, saying the reform would undermine Operation Car Wash, as the Petrobras probe is known.
Temer went from vice president to president this year when he and Calheiros drove proceedings that saw Rousseff impeached for fiddling with government books.
Although Temer has not been formally investigated himself over the Petrobras scandal, it has forced the resignation of several of his ministers.
The political drama deepened last week when corruption suspects appeared to be lining up to make more potentially explosive revelations.
A source close to construction firm Odebrecht told AFP that 77 of its current and former executives had signed a plea deal with investigators in return for lighter sentences.
The 77 include the firm's jailed boss Marcelo Odebrecht, who was reported earlier this year to have named Temer in testimony to investigators.