The Lebanese presidency is set to fall vacant on Oct. 31 unless the main powerbrokers can strike a deal on the election of a successor to Michel Aoun, raising the prospect of a vacuum at a time of deep financial crisis.
Reserved for a Maronite Christian in Lebanon's sectarian system, the presidency has been left empty several times since the 1975-90 civil war. What makes electing a president so difficult, what's at stake, and who are the candidates?
Why so complicated?
The president is elected in a secret ballot by lawmakers in the 128-member parliament, where seats are evenly divided between Muslim and Christian sects.
But voting thresholds mean that no single faction or alliance in Lebanon's polarized politics has enough seats to impose their choice.
This ties the process to complex bargaining over wider issues, including the divvying up of seats in the new cabinet that takes office after the new president is sworn in.
The Shiite Hezbollah party has said there should be consensus on a candidate, effectively requiring the its approval.
The presidency was vacant for 29 months before Aoun - a Hezbollah ally - became head of state in a 2016 deal which saw Saad al-Hariri return as prime minister.
International rivalries, which have long played out in Lebanon's domestic crises, can also complicate the process.
Aoun's predecessor - Michel Suleiman - took office in 2008 in a deal brokered in Qatar that defused a power struggle between Hezbollah and its allies, and rivals.
What Will this mean for the financial crisis?
The ruling elite have done little to address the financial crisis that has impoverished many people and frozen savers out of cash in the paralyzed banking system for three years.
The vacuum could further complicate steps to address it.
In the event of a vacuum, presidential powers should pass to cabinet led by Prime Minister Najib Mikati. But his cabinet has been serving in a caretaker role since a May parliamentary election, and is not fully empowered.
Analysts say this means it will be unable to take major decisions, including concluding international agreements.
This could complicate the finalization of a draft deal with the International Monetary Fund to unlock badly-needed aid - assuming ruling politicians finally enact the long-delayed reforms needed to seal the deal.
Deputy Prime Minister Saade Chami has said Lebanon could still submit its progress to the IMF board for review and approval of the funds, but he was not sure if the final deal would require presidential approval.
Who might eventually become president?
The Maronite community is more politically fractured than others in Lebanon, giving rise to many presidential hopefuls.
One of them is Suleiman Frangieh - an ally of Hezbollah and Syrian President Bashar al-Assad and seen as a strong contender until the group and its allies lost their parliamentary majority in May.
Hezbollah has not yet declared its support for anyone.
Anti-Hezbollah lawmaker Michel Mouawad has won the most votes in four unsuccessful presidential election sessions so far, but not enough to win.
Lebanon's last three presidents were all former army commanders and army commander General Joseph Aoun is seen as a possible compromise candidate.
But analysts and political sources say he would face opposition, notably from MP Gebran Bassil, President Aoun's son-in-law and a presidential hopeful himself.