By Samia Nakhoul and Tom Perry
BEIRUT (Reuters) - The Lebanese parliament elected former army commander Michel Aoun as president on Monday, ending a 29-month presidential vacuum in a political deal that secured victory for his Lebanese Shi'ite ally Hezbollah, Iran and Syria.
Sunni leader Saad al-Hariri, an opponent of Hezbollah and its allies, is set to be named prime minister in the deal that marked a concession on his part and highlighted the diminished role played in Lebanon by his regional patron, Saudi Arabia.
Fireworks echoed across Beirut as the tally of votes cast by lawmakers showed Aoun the winner. It marked the first time since the end of 1975-90 civil war that a Maronite Christian leader with a popular support base was elected to the post reserved for the sect under the sectarian system of government.
Aoun, who is in his 80s, had no real challengers for the position he has long coveted. Suleiman Franjieh, another Hezbollah ally and the only other official candidate, had asked his supporters to cast blank ballots instead of voting for him.
Aoun is best known for fighting two ruinous wars at the end of the civil war, one against Syrian troops in Lebanon and the other against a rival Christian leader. He struck his alliance with Hezbollah a decade ago after returning from exile in France after the departure of Syrian forces in 2005.
At his swearing-in in the Beirut parliament building, Aoun said Lebanon must be protected from "regional fires" - a reference to the conflict in neighboring Syria where Hezbollah is fighting in support of President Bashar al-Assad.
He also promised a preemptive fight against terrorism, in reference to Sunni Muslim jihadists, who have staged suicide attacks against Shi'ite targets and the army in Lebanon, and said camps hosting some 1.5 million Syrian refugees must not become militant hideouts.
But Aoun made no mention of some of the most divisive issues facing Lebanon: Hezbollah's arsenal and Lebanon's position on the war in Syria, where the government's official stance has been one of "disassociation".
Ali Akbar Velayati, Iran's Supreme Leader Ayatollah Ali Khamenei's top adviser on international affairs, said it was a victory for Hezbollah leader Sayyed Hassan Nasrallah, the Tasnim news agency reported.
The United States said it was "a moment of opportunity, as Lebanon emerges from years of political impasse".
A statement from the State Department said Lebanese parties must also uphold international obligations, including U.N. Security Council resolutions which say there must be no authority in Lebanon other than that of the government - a reference to Hezbollah.
Hariri's endorsement of Aoun was driven largely by financial misfortune. His political network in Lebanon has been hit by a cash crunch caused by financial troubles at his construction firm, Saudi Oger.
Saudi Arabia, a staunch rival of Iran, backed Hariri and his allies through years of political conflict with Hezbollah but has been in retreat in Lebanon over the past year while giving priority to its struggle with Iran in the Gulf.
"This is a closing of the page of the past, of political struggles, and the start of a new phase," Interior Minister Nohad Machnouk, a senior member of Hariri's Future Movement, told journalists at parliament.
Druze leader Walid Jumblatt, an old adversary of Aoun's who also relented and backed his presidency, said: "Lebanon has proved its vitality, diversity and democracy in this broken up and destroyed Arab world." Lebanese leaders must now cooperate to confront the challenges facing the country, he said.
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.
The election of Aoun, who led one of two rival governments in the final years of the civil war, ends the longest presidential vacuum in the history of a country that is no stranger to political crisis.
Lebanese are desperate for better government to deal with problems in the economy, infrastructure and basic services that came to a head last year with a garbage crisis that left rubbish to pile up in the streets, creating a public health crisis.
"My dream is coming true," said Bassam Sarraf, a 46-year-old auditor, speaking in Sassine Square in the Beirut Christian area of Ashrafieh, where huge pictures of Aoun and Lebanese flags had been put up by his supporters. "The country needs ... somebody strong, and there's nobody other than Michel Aoun for this."
U.N. special coordinator for Lebanon Sigrid Kaag told Reuters: "We look forward to all institutions being re-energised and revitalized ... and will keep a keen eye on the national elections that should be held next year."
But Sami Atallah, executive director of the Lebanese Center for Policy Studies, held out little hope that the new administration would solve the socio-economic problems that last year prompted a wave of anti-government protests.
"The tragedy of it is when they disagree we go into paralysis. Then, when they agree, we go into collusion mode, and in most cases this is at the expense of citizens. This is the trap we live in until we are able to break this monopoly of power," he said.
(Additional reporting by John Davison, Lisa Barrington, Ellen Francis, Laila Bassam and John Davison in Beirut, by Arshad Mohammed in Washington, and Bozorgmehr Sharafedin in Beirut; Writing by Tom Perry; Editing by Samia Nakhoul and Alison Williams)