First a suicide bomber kills three Libyan soldiers at a checkpoint in the eastern city of Benghazi. When the army sends in reinforcements, Islamist fighters holed up in nearby buildings open fire, killing six more.
It is a typical day for forces loyal to Libya's official government fighting Islamist groups in the city.
The soldiers had hoped for a quick victory after local residents took up arms and joined them. But 16 months later the campaign has stalled as Islamist fighters play cat and mouse with government forces -- picking them off with snipers hiding in residential buildings who are hard to hit with heavy weapons.
The battle for Benghazi is typical of the chaos engulfing Libya four years after the fall of Muammar Gaddafi.
There is no central authority with national reach as the North African country has split between two rival governments each controlling only limited territory, while rebels groups, tribes and Islamist fighters have carved out their own fiefdoms.
In Benghazi, the fighting has reduced parts of the city to rubble but neither side seems able to win.
Casualties are high as the army lacks the training and weapons to handle street fighting. Twenty-five soldiers were killed and 35 wounded in July alone, army special forces spokesman Milad al-Zwai said.
Fighters from Majlis al-Shoura, an Islamist group, will open fire from buildings, trying to lure troops into narrow streets or to persuade commanders to send up helicopters or MiG jets.
Lacking precision weapons, the ageing aircraft from the Gaddafi era struggle to hit the gunmen without damaging entire buildings. When soldiers move into houses where they suspect the fighters are hiding, they are greeted by booby traps, officers say.
"The terrorists are using the latest explosives planted in flats, streets and cars," said Tariq al-Saiti, a military explosives expert in Benghazi. "These devices kill our soldiers."
Government forces last year recaptured barracks lost to Ansar al-Sharia, the group blamed by Washington for an assault on the U.S. diplomatic compound Benghazi in 2012 in which the U.S. ambassador was killed. Ansar is part of Majlis al-Shoura, which does not disclose its casualty figures.
The army commander in the east, Khalifa Haftar, says he controls 90 percent of the city. But Majlis al-Shoura is holding out in the central area around the port and in several other districts. Benghazi's harbour and airport have closed.
The continuing battle has encouraged Islamic State to enter the fray. The militants do not cooperate openly with the Majlis al-Shoura but have started suicide bombings against soldiers, sometimes when fighting is in progress.
Islamic State posted pictures on social media of mortar launchers it said it had built to use in Benghazi. The weapons have been used to fire into buildings when soldiers were approaching, also killing civilians, army officials say.
LACK OF WEAPONS
The internationally recognised government, based in the east since it lost the capital to a rival administration a year ago, has called on the U.N. Security Council to lift an arms embargo imposed during the uprising against Gaddafi in 2011.
"Now we have a regular army with one command and troops under military orders," said Benghazi-based army spokesman Mohamed El Hejazi.
But Western powers have refused to lift the ban as the eastern army is a disorganised mixture of former anti-Gaddafi rebels, army units that defected during the revolution, untrained civilians and tribesmen.
Haftar, a former rebel commander, started the Benghazi campaign as his own private war last year before the eastern-based government, lacking its own forces, made him its official military chief.
The rival government, which controls Tripoli and the defence ministry there, has formed its own force also called the Libyan army, drawing on former rebels who captured the capital last year and expelled the official prime minister to the east.
The Tripoli government, which is not recognised by world powers, supports the Majlis al-Shoura.
Haftar's forces have some jets, helicopters and Soviet-made tanks but rely like other former rebels groups mainly on Toyota pickup trucks mounted with anti-aircraft guns.
"We need sophisticated weapons," said army spokesman Hejazi.
NEW FRONT
When Haftar started his offensive many residents joined him, using weapons obtained during the revolution. They had become tired of repeated assassinations of army officers, judges and activists blamed by officials on Ansar al-Sharia. The Islamists deny this.
But many local people are now exhausted by the conflict. They are forced to queue at bakeries and petrol stations because the fighting has closed the port where wheat and fuel imports used to arrive. Electric power is almost non-existent.
Garbage has not been collected for weeks, adding to the stench from rotting meat in containers abandoned at the port. With the airport closed, people must travel 300km to Bayda to catch a flight.
"Life has become very difficult with the war and rockets fired into buildings," said Benghazi resident Ali al-Feitouri. "On top of the noise from clashes the city is now dark at night due to the outages."
And more trouble is looming for the government. Islamist fighters have opened a new front southwest of Benghazi in Ajdabiya, near the oil port of Brega.
Islamic State killed 12 soldiers there last week, forcing Haftar to divert warplanes to bomb the militants.
Military officials see in Ajdabiya a repeat of what happened in Benghazi, with gunmen assassinating army officers and hoping to draw soldiers into a street war they are ill-prepared to win.