In February 2011, the people of Libya responded to a wave of revolt spreading through the Arab world. After Tunisians and Egyptians forced their own autocratic leaders from power, Libyans marched to the streets to take on Muammar Gaddafi, the brutal dictator who had ruled Libya for decades. The regime responded with force, and revolution quickly turned to civil war. With the help of NATO airpower, Libya’s rebels were able to topple Gaddafi, who was killed in October 2011–allowing Libya to launch a fragile experiment with democracy.
That experiment has yielded chaos. The civil war devastated Libya’s already weak institutions, and a patchwork of militias began battling over the spoils. By 2014, the country was split between two rival governments–opening the door for ISIS to move in. The jihadists established a foothold in Libya’s power vacuum in 2014, eventually taking control of the coastal city of Sirt, Gaddafi’s birthplace, in 2015. Experts feared that even with ISIS losing ground in its home territories in Syria and Iraq, it would still be able to thrive in the turmoil of Libya. It was in the Sirt area that ISIS kidnapped Egyptian Coptic Christian workers, whose murders were shown in a lurid execution video released by the group in February 2015.
That’s why the reports that Libyan militias captured ISIS headquarters in Sirt on Aug. 10 are so important. The offensive, led by militias from the nearby city of Misratah, represents a victory over ISIS and, hopefully, takes Libya a step back from the brink of collapse. If they succeed in retaking the whole city, the militias could effectively eliminate ISIS’s most important colony.
But the victory will come at a cost. Over the summer, the militias were forced to fight through a nightmarish series of ISIS minefields and snipers’ nests. ISIS gunmen managed to inflict dozens of casualties during each new push by the Misratah side. “They are like ghosts,” one Libyan sniper said of the ISIS fighters, speaking to the photographer Lorenzo Meloni, who visited the front lines in Sirt in July. “After an entire day of fighting, of strong fighting, it’s hard to even find the bodies of Daesh fighters,” he says, using the Arabic acronym by which the group is known in the Middle East.
Meloni has returned to photograph Libya every year since the 2011 uprising, witnessing the hope and despair that have come in Gaddafi’s wake. Libya is split between two rival governments, the U.N.-supported Government of National Accord, based in Tripoli, and a rival administration based in the eastern part of the country, where a renegade general named Khalifa Haftar commands his own armed factions. The Misratah militias are aligned with the U.N.-backed government.
Sirt is also the newest front in the U.S.-led war against ISIS. At the request of the Libyan unity government in Tripoli, the U.S. launched five airstrikes on ISIS forces in Sirt on Aug. 1, taking out two tanks, two other military vehicles and a “fighting position,” according to the Pentagon, in its first military action against ISIS outside Syria and Iraq. Ten days later, the militias were able to move in.
The Misratah brigades include some battle-tested fighters, veterans of the revolution against Gaddafi, but others are very young, and many lack formal training. When Meloni went to photograph the front lines in July, he found the militias taking heavy casualties from booby traps and snipers. The ISIS fighters rigged trip wires and triggers attached to doors and windows, making the fighters’ every step a potentially lethal one. “Even on the front line, when there is strong fighting, you hear a lot of fire outgoing and very few incoming,” says Meloni. “That means Daesh is fighting in very small groups, just with very good snipers, and they move quite quickly from a place to another.”
Just as they’ve done in Syria and Iraq, ISIS fighters in Libya make their opponents pay for every yard of ground they take. “It’s a hardened enemy,” says Frederic Wehrey, an analyst at the Carnegie Endowment for International Peace, who also visited the battlefield in July. “It’s just very vicious, house-to-house fighting, block by block, snipers, alleys. It’s slow.” If it holds, the militia’s advance represents an important victory in the battle against ISIS. U.S. airpower may have helped, but it is the Libyan fighters who are doing the fighting–and the dying.
This appears in the August 29, 2016 issue of TIME.