For almost a decade the Libyan capital, Tripoli, has seen a kaleidoscope of conflict.
The heady days of the revolution of 2011 - which unseated long-time ruler Muammar Gaddafi - are long gone.
In the ensuing years there has been a Libyan rendition of the TV series Game of Thrones, all about violent power struggles, involving competing militias, rival governments and, increasingly, foreign players.
In the capital these days the distant thud of battle punctuates the rumble of the traffic, but the streets are busy. This is a city fuelled by oil, coffee and resilience.
The latest round of battle began in April when a renegade commander, General Khalifa Haftar, led forces from his power base in eastern Libya to make an assault on Tripoli in the west.
He heads the self-styled Libyan National Army, and already controls most of the country. But six months on, Tripoli still eludes the moustachioed military strongman, who is backed by the Tobruk-based government. He is stuck on the southern outskirts of the city.
'Casually tossing a grenade'
Gen Haftar has been held off by an array of militias - which often fight each other - now fighting under the banner of Libya's Government of National Accord (GNA).
It is backed by the UN, but its writ barely runs inside Tripoli, much less outside it. It is struggling to keep the lights on and the water running, even in the capital.
During a recent visit to Libya we travelled by pick-up truck through battle-scarred suburbs to reach the lines of the frontline.
There had been little movement since our last trip in April. At moments it felt like 2011 once again, with young volunteers in flip-flops risking death from the enemy - and themselves.
One fighter casually tossed his rocket-propelled grenade into the front seat of a truck - after he had tried and failed to fire it.
Yearning for peace
The commander, Salem Bin Ismail, a slight, softly-spoken figure in a camouflage T-shirt, pointed down a deserted road to Gen Haftar's forces, just 500m (1,650ft) away.
For this veteran of the Nato-backed uprising against Gaddafi, the current conflict is about preventing a return to authoritarian rule in Libya.
"We have had chaos since 2011. I hope this is the last of the wars. We fought against Gaddafi to get rid of military control. Circumstances led us to fight again," he said.
"We want ballot boxes and elections and civilian rule. We believe in democracy," he added.
Gen Haftar: A man of many wars
- At age 26 helped Gaddafi overthrow monarchy in 1969
- Fought against Israel in 1973 Yom Kippur war
- Led Libyan troops fighting in Chad in 1980s
- Captured by Chad's army in 1987; disowned by Gaddafi
- Defected to the US after release in 1990; lived close to CIA headquarters
- Returned to Libya after Gaddafi's overthrow in 2011
- Now regarded as Libya's most powerful military commander
- Backed by the Tobruk administration that includes the parliament elected in 2014
- Also supported by Egypt's ruler, Gen Abdul Fattah al-Sisi
- Said to have ambitions to become "the Sisi of Libya"
For many who defend Tripoli it is more a case of opposing Gen Haftar than backing the GNA - and there are plenty in the capital who support neither.
But Gen Haftar has powerful friends abroad, including Egypt, the United Arab Emirates (UAE) and Russia. Increasingly the battle for Tripoli is another proxy war in the Middle East.
Parallels with Syria
"This conflict is largely sustained by the foreign powers backing Haftar," said Emad Badi, a Libyan non-resident scholar at the US-based Middle East Institute.
"People give Haftar too much credit. He has become a conduit for foreign powers. I think that the decisions are beyond him," he added.
The GNA too has foreign supporters - Turkey and Qatar - but the big guns are on the other side.
"Numerically the number of states that are supportive or leaning towards Haftar are a lot more, and have a lot more political capital than Turkey and Qatar," said Mr Badi.
He believes that even if Gen Haftar manages to enter Tripoli he will not be able to get control of the city, and the battle may drag on, like other long-running wars in the region.
"If you look at Syria and Yemen, some of the same powers are involved," said Mr Badi.
'Burying young people daily'
As foreign players stoke the conflict, Tripoli counts the cost. The World Health Organization (WHO) says that since April, at least 1,000 people have been killed, including around 100 civilians, and 120,000 displaced.
"Every day we are burying young people who should be helping us build Libya," said Fathi Bashagha, the GNA's interior minister.
He accused the international community, including the UK, of failing to support the country since 2011.
"They did not complete the project. They wanted to remove Muammar Gaddafi but they should have supported us to rebuild a country, and to rebuild the army. Instead they left us."
The minister said that with the government focused on the defence of Tripoli, the militant Islamic State (IS) group and al-Qaeda can take advantage of the vacuum.
"They will use this chance. They can grow now in the desert, and they can move, and nobody can stop them," said Mr Bashagha.
And he warned of another danger - that Libya will descend into all-out civil war if the conflict continues.
There have been warnings too from German Chancellor Angela Merkel, who said recently that Libya is starting to resemble Syria.
She is pushing for an international peace conference before the end of the year.
"It's imperative we do everything we can to make sure this does not escalate into a proxy war," she said.
Reports of Russian mercenaries, Egyptian military advisers, and Emirati drones in Libya all indicate it may be too late for that.
You may also be interested in:
The former UK ambassador to Libya, Peter Millett, expects the German conference to take place, but says progress on the ground is probably a long way off.
"Haftar can't and won't win, but Egypt and the Emiratis can't afford to lose. The Egyptians want to control their Western neighbour, and they don't want terrorism on their border. For them it's existential," he said.
"For the Emiratis it's more about ideology. They think they can play a big role in Libya as they have in Yemen," he added.
In the end though, Mr Millett believes the current stalemate will result in a "raggedy ceasefire", and exhaustion will lead to back-channel negotiations and some sort of political deal.
"There will have to be a carve up, and a sharing of oil resources. It will have to be clear that the people and the tribes of eastern Libya will benefit from the money."
He is encouraged by the fact that the UN special envoy for Libya, Ghassan Salamé - a seasoned negotiator - has remained in his post.
"If anyone can pull a rabbit out of a hat he can, said Mr Millett, "but it won't be a good-looking rabbit".