MADRID (Reuters) - Pedro Sanchez was almost certain to become Spain’s new Prime Minister after his socialist party on Thursday secured enough votes to topple Mariano Rajoy in a confidence vote over a corruption case.

Spain's Socialist Party (PSOE) leader Pedro Sanchez smiles during a motion of no confidence debate at Parliament in Madrid, Spain, May 31, 2018. REUTERS/Susana Vera

Sanchez has received the backing of six parties totaling 180 votes in parliament to become prime minister, more than the absolute majority of 176 votes needed to take power immediately if the no-confidence vote is held on Friday as scheduled.

Rajoy’s departure would trigger a second political crisis in southern Europe, further unnerving financial markets already wrongfooted by failed attempts to form a government in Italy three months after a national election.

With most Spanish parties in favor of respecting EU fiscal rules, however, investors appeared to see less risk of an abrupt policy shift than in Italy, where parties have thrown doubt on the commitment to the euro single currency.

Spain's blue-chip index Ibex .IBEX closed down 1 percent on Thursday but the news of Rajoy's likely downfall did not trigger a major sell-off and Spanish stocks were also hit by the trade war the U.S. started with Europe and other allies.

Rajoy, who did not attend the afternoon session of the debate on Thursday, ruled out resigning before the vote in a move that would have slowed down the transition.

Shortly before he secured the key support of the Basque Nationalist Party (PNV), Sanchez had told Rajoy it was still time to leave and avoid the humiliation of becoming the first Spanish prime minister to lose a no-confidence vote.

Slideshow ( 19 images )

“Are you ready to resign? Resign today and leave by your own will,” Sanchez told Rajoy. “You are part of the past, of a chapter the country is about to close.”

“FRANKENSTEIN” GOVERNMENT

The Basque PNV had backed Rajoy’s budget as recently as last week but it decided to remove its support after dozens of people linked to the ruling People’s Party (PP) were sentenced to decades in prison in a long-running corruption trial.

Sanchez said that if he took power he would stick to the budget approved by Rajoy, and would also seek to start a new dialogue with the restive region of Catalonia.

Defending his record on Thursday, Rajoy told deputies his center-right PP has a wide majority of members who are “decent and honest”.

“The Socialists have left us with a ruined country and we brought back growth and jobs,” he said, adding that Sanchez was trying to put together a “Frankenstein” government that would damage the economy.

Two Catalan pro-independence parties as well as leftist Podemos, a relative newcomer, another small Basque group and a party from the Canary Islands have said they will back Sanchez.

Jose Luis Abalos, the member of parliament in charge of formally presenting the motion on behalf of the Socialists, told PP deputies that the court ruling had triggered a wave of indignation across the country.

“While families were suffering the crisis, you were becoming millionaires,” he told PP members in parliament.

Rajoy, whose minority government has struggled after two inconclusive elections in 2015 and 2016 ushered in the most fragmented parliament since democracy returned to Spain in the 1970s, is also coming under fire for a perceived inability to solve a secession crisis in Catalonia.