BENGHAZI, Libya (Reuters) - Opponents of Muammar Gaddafi have managed to cobble together an alliance and, with plenty of NATO help, fight the Libyan leader's forces to what increasingly looks like the verge of defeat.
Now the hard part might be about to begin: The rebels' National Transitional Council (NTC) might soon have to step up and run the country, if Gaddafi is swept aside.
The council has been unable to shake off fears about its ability to govern, let alone remain united, in this oil-producing country awash with weapons. It may face tribal and regional divides and creeping Islamization.
The council, recognized as Libya's legitimate authority by more than 30 countries, says it is ready to lead Libya on a path to stability and democracy.
"Of course we're ready to take over," the head of the NTC's political committee, Fatih Baja, told Reuters. "We've been preparing for this since the first month of the revolution."
The NTC is a disparate group of Gaddafi opponents which emerged in February in the wake of uprisings in neighboring Tunisia and Egypt. It includes former Gaddafi officials.
It is based in Benghazi, operating out of hotels and homes in eastern Libya's biggest city, which feels more like a laid-back seaside town than the hub of a revolution.
The NTC's suburban headquarters is guarded by fighters in pick-up trucks with machine guns mounted in the back. Reporters have to show rebel-issued press cards before passing through a metal-detecting gate.
Along with fly-blown piles of uncollected trash in the streets, there is a sense of disorganization. Rebel officials have earned a reputation for poor communications, both among themselves and with their allies and the media.
Faced with the prospect of Gaddafi's departure after 41 years of harsh rule, they have set up a task force with a plan to take over quickly in the capital, Tripoli, Baja said.
"Security is at the top of the list, to secure Tripoli militarily and socially," he said.
But analysts fear trouble could begin as soon as the inevitable volleys of celebratory gunfire die down.
GADDAFI THE UNITER
"What's uniting the NTC is Gaddafi. When Gaddafi is gone they're going to clash," said a Middle Eastern analyst who declined to be identified.
Rifts already exist in the rebels' rag-tag military force with poorly defined chains of command and loyalties divided among factions.
Old regional divisions are also likely to surface, exacerbated by a perception that rebels in the Western mountains and central city of Misrata have been doing the hard fighting while the leaders in Benghazi enjoyed peace for months.
A harbinger of what could be in store is the still unexplained July 28 killing of the rebels' military commander, Abdel Fattah Younes, a former top Gaddafi security official, after he was taken into custody by his own side for questioning.
While rebel leaders have hinted at the involvement of a pro-Gaddafi fifth column in their own ranks, the killing of Younes has fanned fears of a weak NTC unable to halt a slide into bloodshed as rival factions, including Islamists backed by shadowy interests in the Gulf, bid for power.
"This could descend into chaos," another analyst said.
Baja dismissed fears of rivalry getting out of hand after the NTC takes power, though some conflict was inevitable.
"This is a democratic transition. It's normal," he said.
One problem the rebels should not have to contend with is revenue. With a population of only 6 million and Africa's largest oil reserves, living standards should be on a par with those in Dubai.
While some oil facilities have been damaged in fighting, and it could take several years to get production back to pre-war levels of 1.6 million barrels a day, the new government should be able to begin some exports quickly.
NTC chairman Mustafa Abdel Jalil, a justice minister under Gaddafi who earned respect for standing up to the leader on human rights, has outlined a 20-month transition period to elections, with the NTC continuing for the first eight months.
A soft-spoken consensus builder and unifier, Jalil told a news conference this week that this option was "the best of the worst" and it was unreasonable for the unelected NTC to hold office longer, despite calls for it remain in power for the whole transitional period.
The prime minister of the rebels' shadow government, Mahmoud Jibril, a former top development official under Gaddafi, has extensive foreign contacts and has been the rebels' roving envoy.
But his travels have frustrated some colleagues and foreign backers, and Jibril is now expected to focus on domestic responsibilities, including the nomination of a new cabinet line-up in coming days.
The old cabinet was dismissed for 'shortcomings' related to the killing of Younes. The most closely watched portfolio is that of oil minister, with hopes in some quarters that straight-talking Ali Tarhouni will return.
The rebels only stand on the cusp of power because of what they acknowledge has been the invaluable assistance of NATO air power, and outside help will remain vital.
"They could become one of those moderate Arab states we've been looking for," said a Western diplomat. "But time is of the essence. We have to quickly provide life support to stabilize the country."
(Editing by Douglas Hamilton and Giles Elgood)