MADRID (AP) — Spain appears headed for a political stalemate after inconclusive national elections on Sunday left parties on the right and left without a clear path to forging a new government.

The conservative Popular Party won the election but fell short of its hopes of achieving a much bigger victory and forcing the ouster of the Socialist government’s president, Pedro Sánchez. Instead, the party led by candidate Alberto Núñez Feijóo performed below expectations in most campaign polls.

Although Sánchez’s Socialists finished second, they and their allied parties celebrated the result as a victory as their combined forces won slightly more seats than the PP and the far right. The block that could probably support Sánchez had 172 seats; the right block behind Feijóo, 170.

“It was a pyrrhic victory for the Popular Party, which cannot form a government,” said political analyst Verónica Fumanal, adding that the conservatives will now have to reach out to the extreme right, and even then it will not be enough. «I see a deadlock scenario in Parliament.»

The tighter-than-expected elections are likely to produce weeks of political maneuvering and uncertainty about the country’s future leadership. The next prime minister would be voted in only after the legislators are installed in the new Congress of Deputies.

But Sánchez’s chances of getting the support of the 176 deputies – the absolute majority in the Madrid-based Parliament – ​​necessary to form a government are not great either. The split results have made the hardline Catalan separatist party Junts (Together) the potential king of Sánchez. If Junts calls for a referendum on the independence of northeastern Catalonia, it will most likely be too high a price for Sánchez.

“We will not make Pedro Sánchez prime minister for nothing,” Junts’ Míriam Nogueras said after the results left her party with the keys to power.

With 98% of the votes counted, the PP is on its way to 136 seats. Even with the 33 seats that the far-right Vox is about to win and the only seat expected for a minority party aligning with the PP, it would still fall short of its goal of a big victory.

The Socialists are preparing to occupy 122 seats, two more than they had. But Sánchez can probably summon the 31 seats of his junior coalition partner Sumar (Uniendo Fuerzas) and several smaller forces to at least add more than the sum of the right-wing parties.

The election took place in the height of summer, with millions of voters on vacation and away from their usual polling places. However, applications to vote by mail skyrocketed.

After a month of heat waves, temperatures were expected to average more than 95 degrees Fahrenheit, or up to 18 degrees Fahrenheit above normal in many parts of the country. Authorities distributed fans to many of the stations.