Lebanese lawmakers ended a two-year political vacuum Monday by electing former army chief Michel Aoun as president.
Until Monday, Lebanon had been without a president since Michel Suleiman's term ended in May 2014. The parliament 33 times failed to elect a new head of state due to lack of a quorum.
Aoun, whose candidacy was backed by the Hezbollah terrorist group which is a powerful force in Lebanon’s parliament, promised to protect the country from spillover from the war in neighboring Syria.
The deeply divided parliament took four rounds of voting to elect 81-year-old Aoun, whose supporters flooded streets across the country waving his party's orange flag.
"Lebanon is still treading through a minefield, but it has been spared the fires burning across the region," Aoun said after taking the presidential oath, according to the AFP news agency.
"It remains a priority to prevent any sparks from reaching Lebanon," the Maronite Christian leader said.
Syria's five-year war has been a major fault line for Lebanon's political class, and analysts have warned Aoun's election will not be a "magic wand" to end divisions.
The next challenge will be forming a government and that is expected to take months of wrangling.
Presidential media office chief Rafic Chlala said consultations to name a prime minister would begin Wednesday morning, with an announcement expected at noon Thursday.
It remains unclear if Lebanon's perpetually ineffectual political class can solve key problems, including a trash crisis that has seen rubbish pile up in open dumps.
The parliament that elected Aoun has twice extended its own mandate, avoiding elections because of disagreements over a new electoral law.
After taking the oath, Aoun rode in a convoy of black cars to the presidential palace in Baabda, east of Beirut, where his wife and three daughters were waiting to congratulate him.
In Beirut's majority-Christian neighborhood of Ashrafiyeh, revelers launched fireworks and loosed volleys of celebratory gunfire.
The atmosphere in Jdeideh outside Beirut was one of untrammeled joy, with thousands honking car horns and popping bottles of champagne.
UN Secretary-General Ban Ki-moon congratulated Aoun and said he hopes "Lebanese parties will now continue to work in a spirit of unity and in the national interest."
EU diplomatic chief Federica Mogherini said Aoun's election "opens the way for all political parties to now engage in constructive dialogue".
Iran "congratulated" the Lebanese people, calling the election "an important step to entrench democracy and ensure Lebanon's stability".
Lebanon's 127 lawmakers took nearly two hours to elect Aoun, who failed to secure a two-thirds majority in the first round, according to AFP.
A second round was held and repeated twice, after 128 ballots – exceeding the number of MPs – were cast.
Aoun secured 83 votes, far more than the 50-percent-plus-one majority needed for a second-round victory.
AFP contributed to this report.