Sirte (Libya): When Western officials cajoled Libya's warring factions to support a unity government this year, they said it was a chance for the rival armed brigades to unite against the common enemy, IS militant group.
Libyan forces may be close to winning the battle for the militant group's stronghold in Sirte, but divisions may deepen if one of the most powerful brigades, led by commanders from Misrata, takes control of the prize city.
For Western powers, keen to stabilise the North African country in chaos since its 2011 revolution, the fragile Tripoli government of Prime Minister Fayaz Seraj is the only way to bring together factions that were at war just two years ago.
How the battle for Sirte ends -- Misrata commanders cannot say how long city will hold out -- may determine the fate of Seraj, Libya's alliances and its future oil exports.
The Misrata's brigades, at the front of the fight against IS in Sirte, are backing Seraj but, after losses in battle there, are in no mood for compromise with rivals and are growing frustrated with Tripoli.
"We get nothing from the unity government. This is supposed to be a fight for Libya, but it's been 70 per cent led by Misrata," said Misrata fighter Mohamed Yousef, on the Zafran frontline in Sirte. "If nothing changes, Seraj's time will come. Maybe he will do well, but if nothing changes?"
With no national army, brigades of former rebel fighters, who battled to oust Muammar Gaddafi in 2011 before turning against one another, are powerbrokers who form a patchwork of quasi-fiefdoms across the OPEC country.
Brigade loyalties are often to city, region and tribe over nation. Smaller brigades may ally with Misrata because their interests are threatened by IS. But to the east, Gen Khalifa Haftar's rival forces, long antagonistic to Misrata, have little interest in cooperation.
Two months after they began a campaign to liberate Sirte, Misrata commanders say they are close to finishing a fight that may give them an advantage over Haftar, who along with other eastern hardliners has rejected Seraj's government.
"We are monitoring Sirte," said Colonel Ahmad Messmari, spokesman for Haftar forces. "Regarding operations there, we don't have any connection with them."
Caught in between Misrata and Haftar's forces and with his own base close to Sirte is Ibrahim Jathran, the former rebel whose Petroleum Facilities Guards brigades control key oil ports Ras Lanuf and Es Sider, vital for restarting oil exports.
He has allied with Seraj's government for now, and clashed with Haftar. He says he is working to reopen the ports. But his relations with Misrata are tense. His troops battled Misrata in 2014 over the oil ports.
Brigades from Misrata, the western town of Zintan and other regions already claim competing legitimacy because of their role ousting Gaddafi. They have in the past used military force against political rivals in the absence of strong government.
Mattia Toaldo, Libya expert at the European Council on Foreign Relations, said the fall of Sirte to Misrata may now embolden them: Haftar to push while Misrata is recovering from Sirte, and for Misrata to resist pressure to compromise.
"The victorious end of Misrata's offensive on Sirte could be the harbinger of more infighting between different factions," he said.
"Ultimately, the current relative absence of violence in Libya is very fragile in many areas and could crumble under these multiple pressures."
Misrata forces are surrounding the remains of IS militants holding out in the centre of Sirte in what commanders hope are the final stages of a battle to liberate the city.
Commanders say after taking control of residential areas near the centre, as few as 300 militants may be left in a small area that includes the Ouagadougou conference hall complex, a city hospital and a university.
Fighting eased during the Eid Al Fitr festivities that marked the end of holy month of Ramadan last week but has started to pick up with shelling of the centre.
"They might have someone important still inside, they are acting like a mad dog in a corner, trying to get out," said Abnulsana, a brigade representative at a Sirte command centre.
The loss of Sirte would take away IS's main base in Libya, one it promoted as beachhead in North Africa. Earlier this year, US officials estimated 6,000 fighters were in IS in Libya.
Some commanders and fighters are likely to have escaped to the south along smuggling routes using ties between IS and Nigeria-based Boko Haram, Misrata intelligence chief Brigadier Mohamed Gnaidy said.
But officials worry that if Sirte falls, Libya may face a campaign of bombing, just as IS's loss of territory and the city of Falluja in Iraq led to attacks in Baghdad.
"Some of their leaders may have moved south to create a pocket of resistance," Gnaidy told Reuters. "After Sirte we can expect explosions in cities and checkpoints."
Whatever the outcome of Sirte's battle it has already strengthened Misrata commanders' belief that they deserve a larger say, especially over Haftar who they see as illegitimate.
"We want what we deserve. The international community should put their hands with those who really want to build Libya," Gnaidy said. "There will be no place for Haftar in a Libyan army, not in 100 years."
Haftar, a former Gaddafi ally who returned from exile to help fight in the 2011 war, is despised by many in western Libya who suspect he wants to install a new military dictatorship.
But the general is backed by many in the east who say he has taken on militants there. His hardline supporters have so far refused to accept authority of Seraj's UN-backed government in Tripoli.