(Bloomberg) -- Spain faces at least two months of uncertainty over who will become its next prime minister after right-wing parties seeking to oust Socialist Pedro Sanchez failed to win a majority in Sunday’s election.

Why does Spain face more gridlock?

Sanchez and Alberto Nunez Feijoo, who leads the center-right People’s Party, both claimed victory. The PP is the biggest party in a right-wing bloc that won 170 out of the 350 seats available. The Socialists dominate a left-wing grouping that secured 172 seats. The Catalan separatist Junts have seven seats and could hold the key.

What happens now?

The country’s main political leaders are starting talks with an array of smaller parties to try to form a potential majority of 176 seats and avoid another election. The new parliament will officially be formed on Aug. 17.

What role does the King have?

Once parliament is in place, King Felipe will meet with leaders before inviting one of them to form a government. This would typically be the person whose party won most votes, which in this case would be Feijoo. Investiture debates would then take place in late September.

What does the candidate need to win?

There are two possible voting rounds after the debates. In the first, the candidate attempts to secure the support of an absolute majority of 176 seats. Failing that, a simple majority in the second is enough, in which case abstentions are key.

If Feijoo’s bid is unsuccessful, the coalition between Sanchez’s Socialists and far-left party Sumar will have a chance to secure enough backing to have him reappointed prime minister in late September, leading to a new government in place in October.

Could there be another general election?

If no candidate secures enough seats, parliament will be dissolved by November, giving Spain 47 days to hold another election, which would be in late December or early January.

Share of votes on Sunday:

Right-wing bloc:

  • PP: 136 seats
  • Vox: 33
  • UPN: 1
  • Total: 170

Left-wing bloc:

  • Socialists: 122
  • Sumar: 31
  • Catalan separatists ERC: 7
  • Basque country’s PNV: 5
  • Basque Country’s Bildu: 6
  • BNG: 1
  • Total: 172

Others:

  • Catalan separatist Junts: 7
  • Canary Islands’s CC: 1

©2023 Bloomberg L.P.