BRASILIA (Reuters) - Allies of beleaguered Brazilian President Michel Temer are waiting for a crucial electoral court ruling in early June rather than withdrawing support now, but they are already preparing a grand bargain to pick an interim successor, party leaders said this week.

FILE PHOTO: Brazil's President Michel Temer attends a meeting with representatives of the Brazilian Chamber of Construction Industry and businessmen, at the Planalto Palace in Brasilia, Brazil, May 25, 2017. REUTERS/Ueslei Marcelino

At dinner parties in plush Brasilia residences and in backroom meetings in Congress, Temer’s coalition partners and members of his own party are seeking agreement on a caretaker to replace the scandal-plagued president, who they see as too damaged to govern.

Amid the political turmoil that comes just a year after his predecessor was impeached and removed from office, preserving Temer’s agenda of austerity reforms and pulling Brazil’s economy out of recession is more important than saving the leader himself, sources in Temer’s main three allied parties told Reuters.

Those measures range from reducing a gaping budget deficit through opening doors to foreign investors to weakening labor laws and tightening pensions.

“We have to wait until we can agree on a way forward the day after, to maintain stability and preserve our constitution and democracy,” said Senator Tasso Jereissati, leader of the center-right Brazilian Social Democracy Party (PSDB) that is the largest ally in Temer’s ruling coalition. Jereissati, a wealthy entrepreneur, is among likely candidates to become temporary president.

An electoral court is expected to rule on June 8 or 9 on whether to annul the 2014 re-election of President Dilma Rousseff and her running mate Temer on accusations the ticket was funded by illegal campaign donations.

It had been expected the court would spare Temer by “splitting” the ticket and ruling that Rousseff, as president, should bear all responsibility. But that changed last week when Brazil’s Supreme Court approved a corruption investigation into Temer himself.

If the electoral court nixes the 2014 ticket as a whole, Temer could still appeal to the Supreme Court, dragging out the process.

Young lawmakers in the PSDB wanted to abandon his government immediately last week when the top court approved the corruption probe into Temer. That came on the back of plea-bargain testimony indicating Temer condoned bribing a witness in the sprawling “Car Wash” graft probe and that he had received 15 million reais ($4.59 million) in bribes.

But party elders convinced them to wait so a less turbulent transition could be arranged. Other main coalition allies, the Democrats and the Social Democrat Party (PSD), are similarly waiting for the electoral court decision on Temer’s fate.

Investors sense that Temer will be pushed out. A Reuters poll published on Friday showed that only two out of 30 analysts surveyed May 24-26 see Temer finishing his term in 2018. Yet most of them expect his economic agenda to survive.

Temer, who took over the presidency last year after Rousseff was removed from office over her handling of budget figures, has said he will not resign, despite pressure over the corruption case. He denies any wrongdoing.

If Temer is forced from office by the electoral court ruling, Brazilian law mandates that Congress - where scores of lawmakers are ensnared in the corruption investigation - must choose an interim leader within 30 days.

POSITIONING TIME

Waiting for the electoral court decision has given Temer’s allies time to position themselves and reach a deal with his Brazilian Democratic Movement Party (PMDB), the country’s largest, which is key to approving laws, but is itself splintered into various regional factions.

“We need to negotiate the day after very carefully, and mainly with the PMDB. That way whoever becomes president will have the needed support in Congress to move ahead with the reforms,” a senior PSDB party leader told Reuters on condition of anonymity so he could speak freely.

“We need to find the right person under the right conditions to carry out a soft transition,” the leader added.

Other names being floated are Finance Minister Henrique Meirelles, a favorite of investors who see him as the best bet to keep Brazil’s incipient recovery on track; Nelson Jobim, a former defense and justice minister from Temer’s party who served on the Supreme Court; and lower house Speaker Rodrigo Maia, who would be interim president for the 30 days until Congress chose Temer’s replacement should he fall.

UNTENABLE GOVERNMENT

Analysts say the absence of a figure of national stature - and one with a clean record in Brazil’s scandal-plagued political establishment - could hinder agreement between the dozen parties in the governing coalition. That could play into Temer’s hands as he seeks to hold on to power.

A recent opinion poll showed the Temer administration’s approval rating has sunk to 5 percent, making it Brazil’s most unpopular government since the end of military rule three decades ago.

Demonstrations against his government turned violent on Wednesday, and he briefly deployed troops to contain protesters who demanded his resignation. More protests have been called for this weekend.

Leftist opponents, led by Rousseff’s Workers Party that had ruled for 13 years until she was removed, are calling for early general elections, which are unlikely because that would require Congress to amend the constitution.

Early elections would allow Workers Party founder and former president Luiz Inacio Lula da Silva to run before his possible conviction in one of five corruption trials he faces. If he was found guilty in any of those trials and the verdict was upheld by an appeals court, Lula would be banned from office.

In another pressure point on Temer, several impeachment requests have been filed in Congress. They are unlikely to move forward, as opening the process must be approved by lower house Speaker Maia, a Temer ally.