Lebanon's army and Islamist armed groups, who had clashed early on Wednesday, agreed on an extension of a fragile cease-fire in a second attempt to end five days of fighting in the most serious spillover of Syria's civil war onto Lebanese soil.
The Lebanese army and the Syrian armed groups are supposed to hold their fire for 24 hours, Muslim clerics who are mediating said.
In a televised news conference, they also said three Lebanese soldiers taken captive by the militants had been released, and that the fighters had started withdrawing from the besieged border town of Arsal.
The clerics would also start negotiating the release of the remaining members of the security forces being held in the town, saying they numbered 27: 10 soldiers and 17 policemen.
Earlier on Wednesday, soldiers loyal to the government in Beirut arrested men and evacuated refugees from Arsal on the border with Syria. One Syrian refugee said she had seen fighters' bodies lying in the streets.
"We saw death with our own eyes," said Mariam Seifeddin, a 35-year-old mother of nine, who said she had sheltered with about 50 others in a single room without food or water for three days amid intense fighting.
"The ones suffering are the civilians,” said Ali Hujeiri, mayor of the town.
Officials say the armed fighters are members of the Nusra Front, Al-Qaeda's branch in Syria, and of the Islamic State, an offshoot of Al-Qaeda that has seized large areas of Iraq and Syria.
Meanwhile, Saudi Arabian King Abdullah granted $1 billion to help the Lebanese army to bolster security as it battles the fighters who have seized Arsal, state news agency SPA reported.
Machine-gun fire and shelling broke out Wednesday on the outskirts of the town in breach of a previous 24-hour truce, which began at 7 p.m. local time on Tuesday.
Qassem al-Zein, a Syrian doctor at the field hospital in Arsal, said the hospital had counted 36 dead civilians since the fighting started; about 10 of them people from Arsal and the rest Syrian refugees. At least 17 soldiers have been killed and 22 are missing from the violence in and around Arsal. Reports from inside the town suggest scores of people have been killed there.
The siege of Arsal is the first major incursion into Lebanon by Sunni militants, leading players in Sunni-Shia violence unfolding from Baghdad in the east to Damascus in the west. The violence threatens the stability of Lebanon by inflaming its own sectarian tensions that fueled decades of civil war in the 20th century as groups vied for power.
While Lebanon has officially tried to distance itself from Syria's conflict, the country's powerful Shia movement, Hezbollah, has sent fighters to aid Syrian President Bashar al-Assad. Assad, like Hezbollah, is backed by Shia power in Iran, Saudi Arabia's rival in the Gulf.
Rocket fire, suicide attacks and gun battles connected to Syria's war have plagued Lebanon and the conflict has worsened Lebanon's perennial political deadlock, with officials divided largely along sectarian lines.
The small country appeared to slip further into regional sectarian feud when Lebanese Prime Minister Saad al-Hariri, who has close links to the Saudi royal family, announced the Saudi aid to Lebanon after meeting King Abdullah in his summer residence in the Red Sea city of Jiddah late on Tuesday.
Arsal was the first stop for many civilians fleeing the bloodshed in Syria. Refugee camps in Arsal that provide shelter to tens of thousands of Syrians who fled the war have been badly damaged in the fighting, forcing refugees to seek shelter in the town itself, Syrian activists in the area have said.
The clashes in Arsal began on Saturday after security forces arrested an Islamist commander popular with local rebels who often move across the porous border with Syria.
Al Jazeera and wire services