Michel Aoun, the former Lebanese army chief, has been elected president of Lebanon, ending more than two years of deadlock surrounding the vacancy.
Aoun, 81, secured the presidency by winning the support of 83 MPs, well above the absolute majority of 65 needed to win, according to a tally of votes read out in a televised broadcast from parliament on Monday.
Fireworks echoed across Beirut as the tally showed Aoun the winner.
Aoun, an MP, was shown smiling in his seat. The Lebanese presidency is reserved for a Maronite Christian in the country's sectarian power-sharing system.
READ MORE: What will a new president mean for Lebanon?
Lebanon had been without a head of state for 29 months after Michel Suleiman stepped down as president at the end of his term in May 2014.
Since then, 45 sessions to elect a new leader have failed due to political infighting that led to of a lack of quorum.
Around noon on Monday, more than 100 of the 128-member legislature arrived at the parliament building guaranteeing the needed quorum for the session to start.
The situation turned in Aoun's favour earlier this month when Saad Hariri, the former prime minister who heads the largest bloc in parliament, said he would support Aoun for president.
Hariri's decision to endorse Aoun marked a major political concession, which was seen by some analysts as reflection of a diminished role of Saudi Arabia in Lebanon, and decisive influence wielded by the Tehran-backed Hezbollah.
Saudi Arabia had backed Hariri and his allies through years of political struggle with Hezbollah and its allies.
Hariri's own financial misfortunes are said to have played a big part in bringing about the breakthrough. His political network in Lebanon was hit by a cash crunch caused by financial troubles at his Saudi-based construction firm, Saudi Oger.
Analysts say the position of prime minister, which he previously held from 2009 to 2011, should help him shore up his support ahead of parliamentary elections that are due to be held next year.
Aoun is due to meet MPs later this week on their preferences for prime minister. He is obliged to designate the candidate with the greatest support among MPs, expected to be Hariri.
Lebanese forces tightened security in downtown Beirut in the lead-up to the parliament vote. Army helicopters flew over the city and cars were banned from entering most of central Beirut.
Metal detectors were set up in the streets around the parliament building.
Elsewhere in Lebanon, thousands of Aoun's party supporters gathered in major squares and streets of Christian areas for celebrations.
Aoun will be Lebanon's 13th president since the country gained independence from France in 1943.
He will return to the presidential palace in the southeastern Beirut suburb of Baabda, exactly 26 years after he was forced out of it as army commander and interim premier by Syrian forces and Lebanese troops loyal to a rival commander.
Source: Al Jazeera News