Lebanon's parliament has elected the country's army chief as president, ending a power vacuum that has lasted more than two years.
Joseph Aoun's candidacy was supported by several political parties, as well as the United States, France and Saudi Arabia.
A rival Hezbollah-backed militia withdrew on Wednesday and backed the commander.
The presidency is a largely ceremonial role that is reserved for a Christian under a sectarian power-sharing system.
The election came six weeks after Lebanon's government agreed to a ceasefire to end a devastating war between Israel and Hezbollah that has significantly weakened the Iran-backed Shiite Muslim group.
The Lebanese army is not involved in the conflict and has a key role under the ceasefire agreement, which requires it to deploy troops to southern Lebanon when Israeli troops withdraw and ensure that Hezbollah ends its armed presence there by January 26.
Aoun, 60, is a career military man who has been army chief since 2017.
During this time, he led the institution through deep crises that affected Lebanon.
These include the 13-month conflict between Hezbollah and Israel, a six-year economic depression that is one of the worst on record in modern times, and the 2020 Beirut port explosion that killed more than 200 people.
Lebanon has not had a properly functioning government since the last parliamentary elections in May 2022.
Interim Prime Minister Najib Mikati failed to secure support for a new cabinet before the end of then-President Michel Aoun's term in October, leaving his administration with reduced powers.
Lawmakers have since failed to elect a new president on 12 occasions. The last time was in June 2023, when no candidate secured enough votes to win the first round before Hezbollah and its ally Amal prevented a second round by walking out.
A presidential candidate in Lebanon can usually be elected in a first round if he receives a two-thirds majority – or 86 votes – in the 128-seat parliament, or by a simple majority in a second round. However, spokesman Nabih Berri said Aoun needed a two-thirds majority in each round because he was the acting army commander.
In the first round on Thursday morning, 71 MPs voted in favor of Aoun, 15 short of the required number. Another 37 lawmakers – many of them reportedly from Hezbollah and Amal – cast blank ballots, while 20 ballots were declared invalid.
Berry, who is Amal's leader, then suspended the session until the afternoon, sparking anger among MPs who wanted the second round to take place immediately.
Aoun was eventually elected president after receiving 99 votes in the second round, easily achieving the required two-thirds majority. Nine MPs cast blank ballots in addition to 18 invalid ballots.
As soon as the result was announced by the speaker, television channels showed scenes of celebration across the country.
Aoun was later shown arriving at the parliament building in a suit and then checking security before entering the chamber to be sworn in.