By Roger Hardy
BBC Middle East analyst
Eighteen religions are officially recognised by the Lebanese state
Lebanon is the most politically complex and religiously divided country in the Middle East, which is what makes it such a potentially explosive factor in an unstable region.
Tiny Lebanon baffles outsiders. Even people in the Middle East find its politics confusing.
Set up by France after World War I as a predominantly Christian state, Lebanon is now about 60% Muslim, 40% Christian.
It has 18 officially recognised religious sects and sharing power between them has always been a complicated game.
Lebanese Muslims have tended to look east for support from the other Arab states and from Iran. The Christians have tended to look west to Europe and the United States.
The country's proximity to Israel - and the presence of a large number of Palestinian refugees on its soil - mean it is also intimately tied to the Arab-Israeli dispute.
While Lebanon has plenty of problems of its own, it has also become the arena where many of the region's conflicts and rivalries are played out.
The long conflict which ravaged the country from 1975 until 1990 was both a civil war and a regional war.
It left Lebanon firmly under Syria's thumb, and with a southern strip of territory occupied by Israel as a buffer zone.
Lebanese politics have resulted in a succession of wars and atrocities
Israel has repeatedly intervened in Lebanon to protect its northern border.
The civil war also drew in Iran to fight Israel and support the Lebanese Shia.
In 1982, with Iranian help, the Shia created Hezbollah, the Party of God, which has evolved into a major player in Lebanese politics and an important ally of Iran and Syria.
Israeli forces eventually withdrew in 2000 and Syrian forces in 2005.
But while Syria no longer has a military presence, it has retained political influence through its relationship with Hezbollah.
It is against this backdrop of conflict and polarisation that the war on the Lebanese-Israeli border unfolded during the summer.
The capture of two Israeli soldiers by Hezbollah provoked a month-long Israeli onslaught.
The areas where the Shia movement enjoys support - south Lebanon and the southern suburbs of Beirut - bore the brunt of the Israeli offensive.
Massive demonstrations have pressed both sides' claims
This caused large-scale death and destruction but failed to secure the soldiers' release or Hezbollah's defeat.
Hezbollah claimed it had won a "divine victory".
In the aftermath of the war, the country began the task of physical reconstruction - but was still plagued by its old divisions.
The government is badly split between anti-Syrian and pro-Syrian factions.
The first is a loose alliance of Sunnis, Christians and Druze (a heterodox offshoot of Islam) and enjoys the support of the United States.
The second is an essentially Shia grouping dominated by Hezbollah, with the backing of Syria and Iran.
Symbolising the polarisation is the fact that the president is pro-Syrian and the prime minister anti-Syrian.
The political deadlock has persisted into 2007, defying the mediation efforts of various Arab states.
Relations with Syria are complicated by ongoing efforts to establish an international tribunal to investigate the killing of the former Lebanese prime minister Rafiq Hariri in 2005. Many Lebanese hold Syria responsible for the assassination - something Damascus staunchly denies.
The UN Security Council has indicated that, if Lebanese politicians are too divided to agree on the setting up of a tribunal, it will become the UN's task to do so.
The outbreak of fighting in the north of the country on 20 May has added a new twist to Lebanon's problems.
Clashes between the Lebanese army and a shadowy group called Fatah al-Islam, based in a Palestinian refugee camp near Tripoli, have left dozens dead.
The Lebanese government sees the hand of Syria behind Fatah al-Islam.
Others see a different but no less worrying possibility - that radical Islamists of the al-Qaeda type now see Lebanon, like other failing states, as attractive terrain in which to establish a foothold.