Brazil's Supreme Court has rejected a decision to suspend the Senate president, who has been indicted for alleged embezzlement.
Renan Calheiros defied an earlier injunction by judge Marco Aurelio Mello, who said his position was untenable after the court ruled that he must face trial.
But the court voted to strip him from being in line for the presidency.
His removal could have derailed a government austerity plan.
The controversial proposal, known as PEC-55, is scheduled to go to the Senate before the end of the year.
The legislation includes big spending cuts and is a key part of President Michel Temer's plan to control the budget deficit and revive the country's economy.
Mr Calheiros' suspension would have left the leadership of the Senate in the hands of a leftist senator whose Workers' Party opposes the plan.
By a 6-3 majority, the court decided that, while no indicted person can be in line for the presidency of the country, that does not mean they have to step down from other positions.
As head of the Senate, Mr Calheiros, 61, is second-in-line after the speaker of the Chamber of Deputies, Rodrigo Maia.
Brazil does not currently have a vice president, as Mr Temer, who occupied the post, replaced Dilma Rousseff as president after her impeachment earlier this year.
Mr Calheiros, a major ally of President Temer, is accused of agreeing with a construction company that it should pay maintenance for a daughter he had fathered during an extramarital affair with a journalist.
In a case that dates back to 2007, the company allegedly billed the Senate for the payments.
He was forced to resign as Senate leader at the time, but was re-elected six years later. He denies any wrongdoing.
He is also being investigated in connection with a big kickback scheme at the state-owned oil company, Petrobras. Dozens of politicians, civil servants and businessmen have been detained since the investigation, known as Operation Car Wash, began in 2014.
- 6 December 2016
- 2 December 2016
- 25 November 2016
- 15 September 2015
- 3 January 2019