(Bloomberg) -- When Prime Minister Pedro Sanchez clawed together an unlikely collection of separatist parties to form his first government in 2018, his route to power passed through Catalonia. Now, the autonomous region may lie on his path to defeat. 

Polls indicate that his Socialist Party is on course to place first in Sunday’s Catalan elections. Yet the vote in one of Spain’s wealthiest and most restive regions presents a complex test for Sanchez: the better his party performs, the worse the outcome may be for the premier. 

That’s because his fragile national coalition relies on support from both the main Catalan separatist groups. And if the Socialist Party snatches first place it could enter the regional government with one of them. The other would then have little incentive to continue supporting Sanchez’s government in Madrid.

Sanchez being Sanchez, there’s no betting he won’t wriggle out of yet another tight spot, as he has done many times before. Still, at this point the threat to his coalition is of sufficient magnitude that senior government members are huddled to ponder their next steps. Some are keeping an eye out for new jobs, a person familiar with these deliberations said.

Socialist candidate Salvador Illa is playing down the risks. “If the pro-independence bloc doesn’t have enough seats it will be a shock,” he said over lunch in Barcelona last month. Indeed, lawmakers representing Catalan nationalist groups have held a majority in every regional legislature since 1980.

Polls show that this time, pro-independence parties may find it harder to repeat the feat. The Socialists’ regional branch only improved its standing in surveys of voter intention after Sanchez took an extraordinary five-day break from his duties last month to contemplate his future.

Since he’s returned pledging renewed commitment to the job, the Socialists are projected to get 40 seats in the regional parliament, up from 38 before his very public soul-searching began, according to a poll published by El Pais. 

Because that’s less than the 68 needed for a majority, the greater uncertainty is over what comes next. 

If the Socialists enter what would, in many ways, be an obvious alliance with the left-leaning separatist ERC, the party’s more conservative rivals Junts per Catalunya could withdraw their support for Sanchez in Madrid, where they’re needed to pass legislation including a much-delayed budget. 

Alliance with Junts threatens a mirror of that problem — as well as some of its own. The party is led by Carles Puigdemont, who as president of Catalonia in 2017 made an ill-fated attempt to declare independence from Spain. Last year Sanchez agreed to a controversial amnesty in exchange for help securing a third term in office, in a move which produced an outcry that stretched as far as members of the prime minister’s own party. 

A pact with Puigdemont would mean alienating ERC and trigger uproar in parts of the Socialist Party. 

Puigdemont is campaigning from the small French seaside town of Argeles-sur-Mer, a few kilometers across the border, where he uses a local sports auditorium as his headquarters. Supporters are bussed in for rallies, allowing the 61-year-old to campaign without going to Spain where he risks imprisonment ahead of the amnesty, which is likely to go into effect later this month. 

Read More: Catalan Pariah Returns to Spain With Plans to Retake Power

Illa, a mild-mannered former health minister, may struggle to form a government at all, given that the pro-independence parties have both made a fresh referendum on Catalan independence a condition of their collaboration. That’s a “red line” for the Socialists, he said. 

An officially sanctioned referendum on independence, seven years after an illegal plebiscite unleashed a political storm the country is still struggling to digest, seems like it would be beyond the pale, even for Sanchez. 

But pro-independence parties point out he had said the same about a coalition with the far-left group Podemos and, indeed, the Puigdemont amnesty. He ditched both positions quickly when they became an obstacle to holding onto power. 

Even if the pro-independence bloc come out ahead, it is far from certain that they will strike a deal. The challenge is made harder for all by the unusually stark personal animosities among the key players.

Between Puigdemont and the ERC, “everyone can see that the relationship is not good,” said Jordi Munoz, director at the Catalan research institute Centre d’Estudis d’Opinio. Soon after joining the first ever formal alliance between the two parties, Junts stepped away from it, sending the region on a path to Sunday’s snap election.  

Read More: Spain’s Sanchez Faces Unexpected Test in Snap Catalan Election

A repeat vote may be the most likely scenario, according to experts and party insiders. That won’t be good for Catalonia, it won’t solve any of the fundamental problems facing Spain or its prime minister, but it might keep him on the high wire for another few months at least. 

©2024 Bloomberg L.P.