BEIRUT (Reuters) - Beating back an incursion by Islamists from Syria, Lebanon's poorly armed military has paid a high price - 36 of its soldiers have been killed or captured. But it has gained in one important respect by winning support from Lebanon's fractious politicians.
At odds about so much, including just who their enemies are, leaders from across Lebanon's sectarian divide have shown rare unity by agreeing they have a common foe in the Islamic State - the radical Islamist group that is dismembering Iraq and Syria.
The concern among the Lebanese appears to be shared by their rival foreign patrons, determined to prevent a radical Sunni "caliphate" stretching from the Tigris to the Mediterranean.
With the Lebanese army part of a regional battle against the Sunni radicals, statements of support have come from an unlikely array of countries including Syria and Saudi Arabia, the United States and Iran.
As Syria and Iraq have fragmented with the stunning advance of Islamic State fighters - an offshoot of al-Qaeda - protecting Lebanon from renewed instability is a concern shared by all.
In the case of Saudi Arabia, support came with a promise of an extra $1 billion for the Lebanese security forces.
That put Riyadh - a sponsor of the uprising against President Bashar al-Assad - on the same side as Syria, whose warplanes were bombing the militants in the border zone as the Lebanese army attacked on the other side.
The militants' incursion into the border town of Arsal on Aug. 2 heightened fears they could extend their battleground into Lebanon, already destabilised by the Syrian civil war that has inflamed sectarian tensions between Sunnis and Shi'ites.
The militants pulled out of the town on Wednesday, after sustaining dozens of fatalities, according to Lebanese security officials. They took 19 soldiers with them as hostages.
Lebanon's most significant players have rallied behind the army. They include former prime minister Saad al-Hariri, the most influential Sunni figure, and Hezbollah, the heavily armed, Iranian-backed Shi'ite group that has been fighting alongside Assad's forces in Syria.
Hariri, bitterly at odds with Hezbollah for years, returned to Lebanon on Friday for the first time in three years, saying he planned to discuss how the Saudi funds could be used.
"There are, of course, still many divisions in Lebanon. But no one has a choice other than to back the army," said Nabil Boumonsef, a columnist at the Lebanese daily An-Nahar.
"We know what it means if the army breaks up and what will happen in the whole country. We will become part of a picture stretching from Mosul to Arsal," he said, referring to the Iraqi city on the Tigris River seized by the Islamic State in June.
The Lebanese army's role is twofold, confronting the new militant threat while also helping to shore up national unity at a time of regional upheaval and sectarian strife.
Though it remains hamstrung by outdated weapons - its oldest tanks date to the 1950s - and ammunition shortages, the army has at least obtained the political support needed to act at all.
"Agree on what you want to do and I am ready. We just need political cover," General Jean Kahwaji, the army's Maronite Christian commander, told ministers at a cabinet meeting during the crisis, according to a source who attended.
Wary of sectarian tensions exacerbated by its role fighting just over the border in Syria, Hezbollah said it stayed out of the battle for Arsal, a Sunni town that has already been a flashpoint for tensions unleashed by the Syria war.
Though it has thousands of hardened fighters and its arsenal is more powerful than the army's, including state-level rocket systems, Hezbollah said the battle was the military's to fight.
The Lebanese are all too aware of the risks of sectarianism spreading into the army. Lebanon's slide into the 1975-90 civil war was accelerated by the disintegration of the army along sectarian lines.
The Arsal operation risked sucking the army, drawn from Lebanon's patchwork of religious communities, into a sectarian fire storm. With Hezbollah fighting the same militants on the other side of the border, a handful of Sunni critics said the army appeared to be taking sides with the Shi'ite group.
As the fighting escalated, one Sunni MP - a hawkish member of Hariri's party - ratcheted up the sectarian rhetoric by describing events in Arsal as part of an "Iranian-Syrian plot to subdue the Sunnis".
The lawmaker, Mohamed Kabara, "warned of any decision that turns our inclusive, national army ... into something resembling Maliki's army". He was referring to the Iraqi military which critics say has become a sectarian weapon in the hands of Prime Minister Nuri al-Maliki, a Shi'ite.
Sectarian turbulence has spread from Arsal to other Sunni areas of Lebanon as a result of the battle. Soldiers have come under fire in the northern city of Tripoli. On Wednesday, a bomb targeting an army patrol killed one person in the same city.
But influential voices such as Sunni cleric Sheikh Dai al-Islam Al-Shahaal have helped to contain the fallout. He issued a fatwa, or religious edict, forbidding fighting with the army.
The battle has coincided with national army day. Banners pledging support for the army abound in the streets.
One of Lebanon's mobile operators has launched a campaign allowing subscribers to donate to the army from their cell phones. In a Christian district of Beirut, a church invited worshippers to attend a nighttime vigil for the army.
THE STATE VS. TERRORISM
Including reservists, the army currently numbers about 65,000. It is the most trusted security force in Lebanon, enjoying the support of far more Lebanese than more overtly sectarian internal security agencies.
Experts say Sunnis make up its largest sectarian component, many of them from poor areas of northeast Lebanon. At least eight of the 17 soldiers killed in Arsal were Sunni.
A Shi'ite politician said concerns about the potential for sectarian tensions in the army faded early into the Arsal operation when it became clear that mainstream Sunni politicians, chief among them Hariri, were fully on board.
"The matter is now one of the state, represented by the army, against terrorism, and this has, to a great degree, reduced the tension," said the politician, talking on condition of anonymity because he was discussing national security.
The government, responding to the Arsal crisis, has asked France to accelerate the delivery of weapons being bought with $3 billion of previously pledged aid from Saudi Arabia.
Announcing the extra $1 billion Saudi pledge, Hariri poured scorn on Hezbollah, likening its role in the Syria war to the militants' incursion into Arsal. But he added: "There is a Lebanese consensus on supporting the army and the internal security forces and all Lebanese institutions."
(Additional reporting by Noura al-Sharif in Dubai; Writing by Tom Perry; Editing by Paul Taylor)