Lebanese troops fought a fierce battle Saturday with Islamist gunmen holed up in the historic market of second city Tripoli in clashes that devastated parts of the popular tourist site.
It was the first time since the civil war in neighbouring Syria erupted in 2011 that violence had spread to the market in the northern city's historical centre, which is on the shortlist for selection as a UNESCO world heritage site.
A civilian caught in the crossfire and a gunman were killed, while nine soldiers, eight civilians and six militants were wounded, in fighting that broke out in the city's souks late Friday, a security official said.
He could not say whether the gunmen, most of whom were Lebanese, were affiliated with any group.
"Some of them are Islamists, while others are wanted thugs," he told AFP.
One of the wounded civilians is a journalist working for a Lebanese newspaper.
The fighting broke out after the gunmen attacked an army patrol Friday in the Khan al-Askar area, near the heart of the coastal city, wounding four soldiers.
The gunmen withdrew to the market's narrow alleyways and troops launched an assault on Saturday morning, setting off fierce fighting that continued until early Saturday afternoon.
An AFP journalist who toured the area after the fighting ended widespread damage to shops and vehicles and wounded civilians being evacuated on stretchers.
The guns fell silent at around 2:00 pm (1100 GMT), after at least 24 hours of fighting.
"The army has ended its operation, having arrested a number of armed men and seized quantities of weapons and ammunition from them, while others fled and are being pursued," a statement said.
Dozens of shops were destroyed in the fighting, which included heavy shelling, said the AFP journalist who also saw a charred body and civilians evacuating the wounded on stretchers.
Elsewhere in northern Lebanon, a clash broke out in the Akkar region near the Syrian border, after unidentified gunmen tried to cut off a main road.
Two soldiers were killed in the fighting, the army said, adding that the road had been reopened.
The fighting came nearly three months after a battle in eastern Lebanon between the army and jihadists from Syria's Al-Qaeda branch and the Islamic State (IS) group.
Dozens of civilians, including women and children, who had been trapped in the market during the fighting were able to leave when the clashes stopped.
Some were carried out by ambulances, while others left on foot.
"We are stuck between the army and the gunmen," resident Motassem al-Masri told AFP by telephone before the fighting ended.
"My brother is wounded, but the Red Cross is unable to enter the area. We are begging the army to let us out," said Masri, adding that he could see gunmen on the street.
The AFP journalist said the market area had been completely surrounded by the army, while snipers were positioned on the rooftops.
Tripoli has seen repeated clashes between Sunni militants sympathetic to the rebels in neighbouring Syria and Alawites who back the Damascus regime.
Islamist gunmen in the city have also carried out multiple attacks against the army. They accuse it of cooperating with Shiite militant group Hezbollah, which has sent thousands of fighters to Syria to support President Bashar al-Assad's forces.
In a separate development, an officer was killed and two others wounded when gunmen fired rockets at their vehicle in the village of Minieh 10 kilometres (6 miles) from Tripoli, the military said.