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

The conservative Popular Party won the elections, but it fell short of its hopes of scoring a much bigger victory and forcing the removal of . Instead, the party led by candidate performed .

Even though Sánchez’s Socialists finished second, they and their allied parties celebrated the outcome as a victory since their combined forces gained slightly more seats than the PP and the far-right. The bloc that could likely support Sánchez totaled 172 seats; the right bloc behind Feijóo, 170.

“It was a Pyrrhic victory for the Popular Party, which is unable to form a government," said political analyst Verónica Fumanal, adding the conservatives will now have to reach out to the far-right, and even then it won't be enough. “I see a deadlock scenario in the Parliament.”

The was likely to produce weeks of political jockeying and uncertainty over the country's future leadership. The next prime minister only would be voted on once lawmakers are installed in the new Congress of Deputies.

But the chances of Sánchez picking up the support of 176 lawmakers — the absolute majority in the Madrid-based Lower House of Parliament — needed to form a government are not great either. The divided results have made the hardline Catalan separatist party Junts (Together) emerge as Sánchez’s potential kingmaker. If Junts asks for a referendum on independence for northeast Catalonia, that would likely be far too costly a price for Sánchez to pay.

“We won’t make Pedro Sánchez PM in exchange for nothing,” Míriam Nogueras of Junts said after the results left her party holding the keys to power.

With 98% of votes counted, PP is on track for 136 seats. Even with the 33 seats that the far-right Vox is poised to get and the one seat going to an allied party, the PP would still be seven seats from the absolute majority.

The Socialists are set to take 122 seats, two more than they had. But Sánchez can likely call on the 31 seats of its junior coalition partner Sumar (Joining Forces) and several smaller forces to at least total more than the sum of the right-wing parties.

“Spain and all the citizens who have voted have made themselves clear. The backward-looking bloc that wanted to undo all that we have done has failed,” Sánchez told a jubilant crowd gathered at Socialists’ headquarters in Madrid.

After his party took a beating in regional and local elections in May, Sánchez could have waited until December to face a national vote. Instead, he stunned his rivals by .

Even if this goes to a new ballot, Sánchez can add this election night to yet another comeback in his career that has been built around beating the odds. The 51-year-old Sánchez had to mount a mutiny among rank-and-file Socialists to return to heading his party before he won Spain’s only no-confidence vote to oust his PP predecessor in 2018.

But Feijóo would probably trade spots with his rival if he could.

Feijóo claimed his right to form a government as the most voted party in the election, adding he was “proud” of what his party’s first national election victory since 2016.

“We have won the elections, it corresponds to us to form a government like it has always happened in Spanish democracy,” he said, addressing a crowd aflutter with Spanish flags.

Feijóo focused the PP’s campaign not on what he would do as prime minister, but rather as an attack on what he called the untrustworthiness of Sánchez. The strategy failed. The Socialists and other leftist parties seem to have motivated their voters by drumming up fear of having the anti-feminist, ultra-nationalist Vox in power as a junior member of a possible coalition with the PP.

A PP-Vox government would have meant another EU member has moved firmly to the right, a trend seen recently in Sweden, and . Countries such as Germany and France are concerned about what such a shift would portend for EU immigration and climate policies.

Vox, which had hoped to force its way into power much as other far-right parties have done in other European countries, lost 19 seats from four years earlier.

Vox leader Santiago Abascal said that the Socialists’ results were “bad news for Spaniards.”

“Pedro Sánchez, despite losing the elections, can block (Feijóo’s) investiture and, even worse, Pedro Sánchez could even be invested with the support of communism, the coup-seeking separatism and terrorism, all of whom will now have more leverage in the blackmail than in his previous term," he said.

Yet it seems that the specter of the far-right taking a seat in government, albeit as a junior member to the PP, for the first time since the 20th-century dictatorship of Francisco Franco had proved to be key to the left’s resurgence.

Feijóo had tried to distance his PP from Vox during the campaign, refusing to say that a national coalition was a possibility. But Sánchez, in moving up the election, made the campaign coincide with the PP and Vox striking deals to govern together in several town halls and regional governments following the May ballots.

Even though Feijóo had pledged he would maintain his party’s commitment to fighting gender violence, Vox campaigned on rolling back gender violence laws. And they both agree on wanting to repeal a new transgender rights law and a democratic memory law that seeks to help families wanting to unearth the thousands of victims of Franco’s regime still missing in mass graves.

“PP has been a victim of its expectations, and the Socialists have been able to capitalize on the fear of the arrival of Vox. Bringing forward the elections has turned out to be the right decision for Pedro Sánchez,” said Manuel Mostaza, director of Public Policy at Spanish consultancy firm Atrevia.

Spain’s new Parliament will meet in a month. King Felipe VI then appoints one of the party leaders to submit him or herself to a parliamentary vote to form a new government. Lawmakers have a maximum period of three months to reach an agreement. Otherwise, new elections would be triggered.

The election took place at the height of summer, with millions of voters likely to be vacationing away from their regular polling places. However, postal voting requests soared.

Coming on the tail of , temperatures were expected to average above 35 degrees Celsius (95 degrees Fahrenheit), or 5 to 10 degrees Celsius above normal in many parts of the country. Authorities distributed fans to many of the stations.

“We have the heat, but the right to exercise our vote freely is stronger than the heat,” said Rosa María Valladolid-Prieto, 79, in Barcelona.

____

Associated Press writer Joseph Wilson reported from Barcelona. AP journalists Aritz Parra, Renata Brito, David Brunat, Iain Sullivan, María Gestoso, Alicia Léon and José María García contributed to this report.

The ɫtv Press. All rights reserved.