Tripoli - As Libya's political leaders convened in Geneva last week to hammer out a unity government deal, fighters with the Islamic State of Iraq and the Levant (ISIL) group were violently crushing a civilian rebellion in Sirte.
As armed residents rose up against them, ISIL fighters launched a brutal assault on Sirte, reportedly beheading people and stringing up bodies on posts around town.
Libya's duelling governments in Tobruk and Tripoli said they had bombed ISIL targets in Sirte, but desperate pleas for help from the city's battling residents, most in an area called District Three, went unanswered. ISIL fighters have also been engaged in battles in Benghazi and on the outskirts of Derna, where they recently suffered a defeat.
A lot of Libya's undoing is who controls the monopoly on force, and what the militias are going to do. A new unity government in Tripoli could fall victim to militia pressure, so the question is who will protect the new institutions?
United Nations special envoy Bernardino Leon, who has been brokering the Geneva talks, condemned ISIL's brutality and urged Libya's divided leadership to form a national government - a move that would allow the international community to lend support to a unified Libyan assault on the group.
"The UN-sponsored dialogue is the nearest thing to a solution to the Libyan crisis," Ali Abusetta, a Misratan municipality member who has joined the talks, told Al Jazeera. "We are asking the government and international community for help fighting ISIL. We don't want to be alone; this is not just Misrata's fight."
Misrata, about 200km west along the coastal road from Sirte, has borne the brunt of ISIL clashes since the group began to take advantage of Libya's civil strife in February, releasing a video showing the gruesome beheadings of 21 Egyptian Coptic Christians on a Tripoli beach.
Forces in Misrata, which has been a significant base for Libya Dawn's military coalition with the Tripoli-based government, have been stretched thin on several fronts as they have fought General Khalifa Haftar's Operation Dignity alliance, affiliated with the government in Tobruk. They had hoped to avoid being mired in messy urban combat with ISIL.
Last March, when deadly clashes broke out between heavily armed ISIL fighters and Brigade 166, the Misratan forces tasked to Sirte, Haftar ramped up his assault on Libya Dawn forces on Tripoli's outskirts.
Outgunned by ISIL and lacking material support, the Misratan forces were forced to retreat last June, with ISIL grabbing control of Sirte's government buildings, ports, and local water and power sources. ISIL fighters also infiltrated the roads heading east and south from Sirte, providing easy access to Libya's central oil fields.
Locally, ceasefires have been brokered between warring factions in western Libya - between Misrata and groups in Zintan, Washafana and Zawiyah. Since Sirte's recent violence broke out, Misratan forces have urged the communities to unify and send one strong fighting force to tackle ISIL. But the combined military might has yet to materialise.
Amid this backdrop, Libya's population is hurting. On top of raging conflicts in Benghazi, the south, and until recently, the west, Libya's oil industry produces below 400,000 barrels per day (bpd), down from a peak of 1.6 billion bpd before the ouster of former leader Muammar Gaddafi. The economy is in tatters, while the smuggling of people and subsidised goods, such as food and gasoline, is booming.
Government salaries are often unpaid, and daily power cuts in Tripoli can last up to 12 hours. The proliferation of armed groups and the constant threat of violence have forced international investors, embassies and charities to flee.
Last month in Morocco, many of the opposing factions in Libya signed the Skhirat agreement, which outlines terms that would move the country closer to a peace deal, but the Tripoli-based General National Congress (GNC) rejected it, saying it gave more power to the rival government.
However, a GNC delegation was ultimately persuaded to show up for the two-day talks in Geneva last week. Leon hopes the GNC will rejoin the talks to sign off on the finer print. The GNC delegation has now returned to the capital to persuade their peers to attend the next round of talks in Morocco and hammer out the agreement's annexes.
"A key sticking point is the GNC wants some sort of veto over the army commander - Haftar is toxic to them - and what a military structure will look like," Frederic Wehrey, a senior associate with the Middle East Program at the Carnegie Endowment for International Peace, told Al Jazeera.
"A lot of Libya's undoing is who controls the monopoly on force, and what the militias are going to do," Wehrey said. "A new unity government in Tripoli could fall victim to militia pressure, so the question is who will protect the new institutions?"
There remain many gruelling decisions on the deal's five key annexes: selection of leaders, how the state council would work, a government action plan, constitutional amendments, and the management of Libya's finances.
Leon wants the agreement wrapped up by the end of August, but the sticking points are huge. The biggest issues include the role of Haftar, whose leadership ambitions Libya Dawn vehemently rejects, as well as the continuing GNC boycotters. And bringing reluctant leaders and militias in Tripoli on board will be imperative for a future unity government to take over capital buildings.
One security official in Misrata told Al Jazeera that a unity government is the best way to get indirect aid from the international community to fight ISIL. In the meantime, he urged local communities in Libya's west to fight.
"The biggest enemy is ISIL, not Haftar," he said. "All the people who were fighting in the west of Libya should unite and fight the common enemy, which is ISIL."