BEIRUT, Oct. 31 (Xinhua) -- Former army chief Michel Aoun was sworn in as the 13th president of Lebanon on Monday, ending a vacancy that lasted almost two and a half years.

Aoun, an 81-year-old Christian former army chief, was elected president earlier on Monday in the Lebanese parliament.

The election of Aoun as president came after the surprise endorsement of his candidacy by Saad Hariri, a former prime minister now heading al-Mustaqbal Movement.

Aoun is allied with the Iran-backed Hezbollah party whose forces are fighting in Syria alongside forces of the government of President Bashar al-Assad.

A fierce opponent of the Assad government in Syria, Hariri is the leader of a bloc that rivals Hezbollah and enjoys the support of Saudi Arabia.

Aoun is expected to nominate Hariri to return as prime minister, but with little consensus in the political landscape, the process of forming a government is likely to be long and arduous.

Lebanon has been without a president since May 2014, when former president Michel Suleiman's six-year term ended.

Since then, parliament had held 45 failed sessions to elect a successor, each time failing to make quorum.

According to the constitution, the president should be elected with two thirds of votes in the 128-seat parliament in the first round, and with a simple majority in the following rounds.

The power sharing pact stipulates that the president should be a Christian Maronite, the speaker a Muslim Shiite and the premier a Muslim Sunni.