Libya after Gaddafi: Who's in charge?
With remnants of the Gaddafi regime restricted to a few last outposts, Libya's transitional authorities now face the challenge of running a country emerging from war.
The National Transitional Council (NTC), formed in the eastern city of Benghazi to lead the uprising, is gradually establishing itself in the capital, Tripoli, with ambitious plans.
It wants to form a new interim government by the end of September, and hold elections for a 200-strong national congress within eight months. The congress will then draft a constitution, paving the way for multi-party polls.
But power structures within Libya remain fractured, creating the potential for conflict as a wide range of groups, interests and allegiances jostle for position.Competing for credit
The NTC will have to secure the co-operation of these groups to achieve its goals.
"They have a lot of challenges to overcome before they can get the wheels of government running smoothly," says Ahmad Fawzi, spokesman for the UN special adviser for Libya, Ian Martin.
"They are conscious of the fact that they need to be seen to be running the country from the capital, and we haven't seen that yet."
Most immediately, this may be a question of asserting authority over those who accumulated power on the ground during six months of conflict.
NTC chairman Mustafa Abdul Jalil and acting prime minister Mahmoud Jibril have now arrived in Tripoli, but the brigades who conducted the military campaign were there weeks before.
- New government within 10 days
- Elect national congress in eight months
- Referendum on new constitution within 90 days of congress meeting
- Multi-party polls in 2013
An uprising within Tripoli was carefully planned to coincide with the assault led by seasoned Berber fighters from the Nafousa mountains and Misrata, but brigades from different regions have begun competing for credit for liberating the capital.
It is not clear when the brigades will disband, and some weapons have already gone missing.
The brigades are meant to answer to a Supreme Security Committee (SSC), a sprawling new body led by interim oil and finance minister Ali Tarhouni that also includes the police, the interior and defence ministries, and neighbourhood committees.
But the security structure is fragmented - cities have been running their own military affairs, volunteers soldiers are said to be reluctant to obey the national liberation army, and in some neighbourhoods, competing committees have sprung up.
Factions may also be divided. There were reports on Sunday that at least 12 people had been killed when two groups of anti-Gaddafi fighters clashed in the west in a dispute over the ownership of heavy weapons.
Fighters from Misrata, which suffered a brutal and lengthy siege by pro-Gaddafi forces, have begun to challenge NTC authority, reportedly refusing to turn over abandoned tanks.Regional rivalries
The Misratans will be seeking recognition for their recent ordeal, while those in the far east and west will be seeking recognition for more long-running discrimination at the hands of the Gaddafi regime.
This could contribute to regional rivalries in the longer term, particularly once Libya's oil economy recovers and billions of dollars in revenue start to flow.
The uprising began in the east, and easterners have so far been over-represented in the NTC. Benghazi has nine members to Tripoli's five, and residents of the eastern city dominate the council's executive committee.
End Quote Ahmad Fawzi UN spokesman
The top echelon is being asked to stay at home - those who were responsible for gross violations of human rights have either disappeared or been killed ”
They have been criticised for being slow to come to Tripoli, though this was at least partly due to security concerns.
Mr Jibril has promised that east, west "and even the cities still under siege, will be part of a new government", and the NTC says it could double in size to nearly 100 members once national liberation is achieved.
But even redressing the balance could cause tensions. In recent days there have been protests in Benghazi by people who say they are worried too much power will go to the capital.
Competition between regions is expected to eclipse any tribal, ethnic or cultural splits.
Tribal identities were at times played up by Col Gaddafi, but while they can be socially important, many analysts and transitional officials say they are unlikely to impact politically.
A transitional "covenant" published in August promises in its first article to protect the language rights and culture of the "Amazigh, Toubou and Touareg and other constituents of Libyan society".
But another potential source of tension is the division between "insiders" who remained in Libya during the Gaddafi era and the conflict, and "outsiders" who have come back from abroad.
"If there's going to be large proportion of outsiders I can see that could create a lot of resentment - the outsiders tend to be relatively rich," says Mohamed El-Doufani, an analyst at BBC Monitoring.
The close involvement of the West in the military campaign could reinforce this resentment, he adds.
"There will be suspicions as to whether they're talking on behalf of another country, or whether they are for the national interest."Islamists and secularists
There could also be an ideological dimension, with growing talk of a divide between secular technocrats who studied and worked overseas, and Islamists who opposed Col Gaddafi's rule from within Libya.
Most prominent among the secularists is Mr Jibril, who has studied and taught in the US and spent much of the conflict abroad, lobbying for the NTC.
Most prominent among the Islamists is Abdel Hakim Belhaj, a former leader of the Libyan Islamic Fighting Group, who was elected as head of Tripoli's military council against Benghazi's wishes.
Mr Jibril has denied any rift between him and Mr Belhaj, while Mr Belhaj has pledged to work for "a civil state that respects the law and rights", and to lay down his arms.
Despite all the possible faultlines, observers note an abundance of goodwill, a relative lack of infrastructural damage, and the potential for Libyans to guide the transition themselves.
The UN's Ahmad Fawzi said he was "cautiously optimistic" after a five-day trip to Tripoli and Benghazi, and did not expect the kind of violent retribution seen in Iraq.
"The top echelon is being asked to stay at home," he said, while "those who were responsible for gross violations of human rights have either disappeared or been killed".
But others will be allowed to stay in place and work for the NTC's goals of elections, security and justice.
"It's a very mature approach to revolution," said Mr Fawzi.