* Premier's abduction reveals militia rivalries
* Coastal Libyans see Shields Force as counter to Bedouin tribal militias
* Uneasy balance of power holds militias back
By Ulf Laessing and Suleiman Al-Khalidi
TRIPOLI, Oct 18 (Reuters) - When gunmen snatched Libyan Prime Minister Ali Zeidan from his Tripoli hotel last week, it was a rival armed militia he thanked for his rescue hours later.
Even for Libyans accustomed to their democracy's unruly beginnings, the drama at the Corinthia Hotel was a startling reminder of the power former fighters wield two years after they ousted Muammar Gaddafi, and the dangers of their rivalry.
Police and troops from Libya's nascent army were at the scene, but the former militiamen showed they are the arbiters in a struggle between rival tribal and Islamist leaders over the post-revolution spoils of the North African oil producer.
Between them, they have edged Libya close to a new war that threatens the democratic gains of the NATO-backed revolt.
Too weak to take back control of a country awash with Gaddafi-era weapons, Libya's central government has been forced to try co-opt militias into semi-official security services over which it exercises little control.
"We want to build a state with an army, police and institutions, but there are some people who want to obstruct this," Zeidan, still in his pyjamas, told reporters after his release, referring to critics in parliament who had been planning a vote of no confidence, accusing him of failing on security.
Tripoli has been spared the major militia clashes seen in the eastern city of Benghazi. But the standoff is evident; gunmen from two rival groups sit in pickup trucks mounted with anti-aircraft cannons in different parts of the capital.
In the east, the Libya Shield Force and Islamist militias drawn from anti-Gaddafi fighters based in the country's fertile coastal areas and their commanders from Misrata city are entrenched at the Mittiga air base.
Across the city, powerful tribal Zintan militia, part of a loose alliance of mostly secular Bedouin groups from the desert interior, once recruited into Gaddafi's security forces, control an area around Tripoli's international airport.
The militia rivalries mirror a struggle within Libya's fragile government, where the secular tribal alliance controls the defence ministry and the Islamist-leaning Libya Shield Force works under the interior ministry.
Parliament is split on similar lines, with a secular National Forces Alliance at loggerheads with the political wing of the Islamist Muslim Brotherhood over Libya's future.
Zeidan's captors, allied to the Shield Force, said they were motivated by anger over a U.S. raid to capture a top al Qaeda suspect in Tripoli. The premier, freed by a defence ministry-allied militia, called his abduction an attempted coup.
Tensions with the Islamists have risen since the premier's September visit to Egypt, where they accused him of endorsing the military's ouster of Islamist President Mohammed Mursi.
"The political outcome of the revolution hasn't been finalised and people still think there are things to be won and things to be lost," a Libya-based Western diplomat said.
REVOLUTION NOT FINALISED
Zeidan had been held in a government office by gunmen from an Islamist militia allied to the Shield Force. Details of his release are still hazy, but a loyal militia fired rocket-propelled grenades outside the office just beforehand.
Riccardo Fabiani, a North Africa analyst with Eurasia Group said militias appeared to be using their muscle for specific demands. But that might spin out of control if accusations Zeidan's political foes orchestrated his abduction proved true.
"That would significantly alter the outlook and could plunge Libya into chaos, as other groups would have a reason to rise up against an attempted coup."
In Benghazi, regional capital of the oil-rich eastern Libya, where Islamist militants attacked the U.S. embassy a year ago, militiamen backed by the army clashed earlier this year with the Libya Shields Force. More than 30 people were killed.
For months, militiamen commanded by a former security chief have held key ports in the east, halving the oil exports of the OPEC member, Africa's third largest producer and a key supplier to Europe. A powerful western tribal militia has kept Gaddafi's captive son in its desert stronghold.
Even before the premier's abduction, the fight had come to Tripoli when Zintan fighters went on a rampage of looting in July in Abu Salim, a residential area, to avenge the death of several of their men by their Islamist leaning rivals.
The Zintans brought out heavy armoured vehicles looted from Gaddafi's bases and burned down the Islamist office. Only intervention by tribal elders averted a wider militia war.
MILITIAS TAKE PAY, NOT ORDERS
More than 225,000 Libyans are registered in dozens of militias under nominal state control. They receive government salaries but act autonomously, taking orders from local commanders or their affiliated political leaders and have resisted campaigns to recruit them into the security forces.
Libya is still negotiating with Britain, Turkey and Italy over training for its nascent armed forces, but NATO said last week it was still considering how the security situation on the ground might affect its assistance.
U.S. military training is in the planning stages, and Britain has said its main training may start early next year.
Western powers worry that the vast uncontrolled regions of southern Libya have already become a haven for Islamist militants with links to local al Qaeda branch. A weak state also gives militiamen little incentive to hand over their weapons.
"Some militias have started engaging in smuggling of weapons, drugs and refugees. They are unlikely to give up that business," said another western diplomat in Tripoli. "And they won't run out of weapons or ammunition any time soon."
The Libya Shield Force was set up last year by the parliament fed up with government's repeated failure to control tribal militias. Assembly members approved millions of dollars of budget allocations to re-equip it as a reserve army.
"With their arrival a balance of power returned to Tripoli," said Ahmeida Dali, a GNC member who lobbied for the Shields Force to come into the capital.
Its arrival upset tribal Arab Bedouin militias, including the Warfalla, the country's largest tribe, and the powerful Zintans, but was welcomed by many Tripoli residents fed up with unruly elements among the Zintans who ransacked Gaddafi's palaces and seized weapons and funds before his final fall.
"We need them badly to prevent the city from being held hostage by these tribal Bedouin gangsters," said Yousef Ashour, sipping Italian cappuccino in a cafe in the Qaraqesh upscale neighborhood of Tripoli.
Anti-Islamist leader Mahmoud Jibril, from the Warfalla tribe, has been promoting a revival of tribal alliances and his National Forces Alliance is unlikely to give up its state-funded militias to a national military under control of a rival.
Some tribal militias appear to be preparing for a possible showdown with their Islamist rivals over Tripoli.
"Al-Qaeda, the Salafis and the Shields are all the same," said one tribal militia commander named Ali. "They should be wiped out. We won't let them take over Libya."
Our Standards: The Thomson Reuters Trust Principles.