Tripoli, Libya: When a militia holding Libya's eastern ports loaded a North Korean-flagged tanker with oil earlier this month, the Libyan parliament sacked its own prime minister and turned to U.S. commandos to bring its cargo back.

For days the government had threatened to blow up the tanker, called Morning Glory, if it left port. When it sailed off, pro-government militiamen even gave chase on boats carrying jeeps mounted with anti-aircraft and cannons.

But that failed, and when the tanker reached international waters Libya's parliament fired Prime Minister Ali Zeidan, who fled to Europe. A few days later, U.S. Navy SEALS boarded the tanker to end the debacle.

The Morning Glory affair is one of the starkest symbols yet of how weak Libya's central authority is. Three years after a NATO-supported revolt toppled Muammar Gaddafi, Libya is at the mercy of rival brigades of heavily armed former rebel fighters who openly and regularly defy the new state.

Libya's parliament agrees on little, its interim government has no army to enforce security let alone impose its will, and a new constitution meant to forge a sense of nation remains undrafted.

In the vacuum, ex-fighters have briefly abducted Zeidan from his Tripoli hotel room, stormed the foreign ministry, and taken over the interior ministry, even before the renegades made their failed attempt to export oil.

Lawmakers joke that they may need to use the secret tunnels Gaddafi built under the capital so they can escape the marauding gunmen.

"Really there is no army, I thought there was one, but then I realized there really isn't any," ousted premier Zeidan said from Germany where he fled.

For many Libyans, the joy of freedom after decades under Gaddafi has given way to confusion. Libya has descended into a scramble over the future shape of the nation, with ex-rebel commanders, former exiles, Islamists, tribal leaders, and federalists all jostling for position.

At stake is the stability and integrity of this vast North African territory, rich in both oil and gas.

Neighbouring Tunisia, where the Arab Spring began, has made its uprising work. A new constitution was adopted in January, Islamist and secular parties have compromised, and elections are due this year.

Libya, by contrast, is floundering.

"There was a euphoria that accompanied the overthrow of the dictator that did not take into account some of the stark realities ... What is the unifying idea here?" one Libya-based Western diplomat asked.

"It's not as though removing Gaddafi was going to mean the ... box would open and out pops Dubai. All the problems that were covered over, papered over or bribed over or suppressed, they are emerging again."

PULLING TEETH

Working his phone to resolve another Tripoli blackout, Libyan Electricity Minister Ali Mihirig knows better than most how hard it will be to get the country working together. Back in Libya after three decades living in Canada, Mihirig is not only in charge of electricity but has spent the past year as a mediator and negotiator among the country's myriad factions.

"It is like pulling teeth," he said of convincing former fighters to put down their guns and abandon their bases.

"It is painful, it is hard, sometimes you need anesthesia ... We have strong armed groups ... Fortunately or unfortunately, they don't agree with each other, which keeps this process going."

The government has negotiated with militia chieftains to give up command posts they seized when they liberated Tripoli. The army is recruiting more and the government co-opted former fighters by putting thousands of them on the state payroll.

But that has often empowered rival militias and created a mishmash of security forces and quasi-official military units. Even on a casual drive outside Tripoli, visitors pass checkpoints manned by guards whose ragtag uniforms are no clue to affiliation.

The former rebel groups, political factions and tribes are proving more loyal to their vision of Libya than to the compromises required in a unified state.

In Benghazi, in the country's east, three key ports have been seized by a group of former oil security forces who defected with their leader Ibrahim Jathran, a former Gaddafi fighter, last summer. They want more autonomy for the region.

Ethnic Amazigh, the berber people who have long felt oppressed by Libya's Arab majority, have also targeted the country's oil infrastructure. Armed Amazigh shut down the vital El Sharara oilfield for two months last year to demand more rights in the new constitution.

An Islamist militia, the Operations Room for Libya's Revolutionaries, has been accused of kidnapping Zeidan and briefly snatching five Egyptian diplomats in Tripoli to secure the freedom of their commander who was arrested in Egypt. Its commander, Shaban Hadia, denied all kidnapping allegations.

Rival militias are also lined up on competing sides of Libya's divided parliament where Islamists, represented by the Justice and Construction Party, a branch of Egypt's Muslim Brotherhood, are deadlocked with the National Forces Alliance, a group of nationalist and liberal parties led by a former Gaddafi official.

But the two most powerful groups in the country are the militias west of the capital, one in the mountain town of Zintan and the other in the port city of Misrata. Bristling with weaponry and a sense of entitlement, the rivals both claim the mantle of champions of the revolution. Each brigade is loosely allied to competing political factions, and neither shows any sign of disarming or falling in behind the government in Tripoli.

"We are keeping our weapons, not because we want to end the state, but we are waiting for a real organisation to appear," said Khalid Imohammed, a former military commander in Zintan.

THE VIEW FROM ZINTAN

Imohammed was a supermarket manager during the Gaddafi years. He took up arms early in the uprising, at first to defend his town, and then to oust the Libyan leader.

These days he feels a new sense of outrage. Like many in Zintan, an impoverished town of around 35,000 people some 140 km (90 miles) west of Tripoli, he complains that he has seen little of the oil riches or development he believes the capital and other cities enjoy, and laments the lack of basic services, new schools, hospitals, even a basic water supply.

"Winning this war was a gift from God and made with the courage of the Zintan people," Imohammed, dressed in traditional brown robes, said. "And what did we get? We didn't see any change. Now we are in a different war, a political war. But they are just fighting for private gain, not like our sacrifices."

Zintan city council leader Mohammed al Waqwaq puts it more succinctly: "Zintanis felt it was a duty to fight. And that duty was not rewarded."

That's one reason the group has not given up their greatest prize: Saif al-Islam, Gaddafi's son, who was captured by the Zintanis, and is still held by them despite requests by both Tripoli and the International Criminal Court in the Hague to hand him over.

City council leaders say Saif will be held and tried in Zintan because it is the only place that can guarantee his security. Tripoli cannot even protect its own prime minister, they say.

THE MISRATA MODEL

Some 160 km from Zintan, the coastal city state of Misrata has been booming since the 2011 uprising. Its port, Libya's biggest, saw a record number of containers uploaded last year, while the city has big plans for hotels, shopping malls and foreign language schools.

Misrata suffered some of the worst fighting during the rebellion against Gaddafi. But dozens of new outlets from fashion retailers to restaurants now flourish.

"The experience of the war has brought people to work together and help each other," said Mohammed El-Swayah, manager in the free port authority, who goes on to list business opportunities for foreign firms.

Diplomats have another explanation for the better security in Misrata: regular military units check all vehicles that enter the city, a procedure rare elsewhere in Libya. Misratan entrepreneurs are also paying former rebels to provide security.

Locals are convinced Misrata can be a model for the country. "We in Misrata started already in July 2011 (during the uprising) a plan for future industrial development," said Bashim al-Tarablus, head of a local business council. "In Benghazi, the revolution was over in three days but they didn't plan anything for long."

The Misratan forces make up most of the Libya Shield, the semi-official armed body created by the transitional parliament to protect Tripoli against a resurgence of pro-Gaddafi forces. Though seen by many as Islamist-leaning, the Shield is a potential backbone of a new army. It is also a powerful counterweight to the Zintan brigades.

"DIFFICULT TO DO"

One of the main reasons Libya is failing to pull together is the almost complete absence of strong state institutions.

Libya's first modern ruler was King Idris, an inward-looking tribesman who mostly stayed at home in the east. Idris was followed by Gaddafi, who shaped the country in his own image.

Both men shunned state institutions and accountability, relying instead on tribes and the largesse and jobs of international oil companies. That helped to buy loyalty and eased social tensions. But while public service ballooned - today some 1.2 million Libyans, almost a fifth of the population, work in the public sector - institutions were neglected.

"Each person is looking only after his (own) interest and not working as nation," said Ali Mohammed Salem, deputy central bank governor who estimates it will take at least five years to build up an efficient state.

The United Nations and Western governments have cajoled Libya's factions to keep the transition on track. A committee has been elected to start writing the constitution, and the parliament has agreed it will run elections as soon as possible.

"They need to come to some kind of national consensus on what kind of country they want. It is easy to say and very difficult to do. To do that you need some political leadership," said another Western diplomat.

The army, built around a core of 8,000, is training with the help of U.S., British, Italian and Turkish aid. But most programmes have just started.

Shaban Hadia, the commander of the group blamed for kidnapping Zeidan and the Egyptian diplomats, said his group is actually helping maintain security.

"We are now an alternative until the army and the police are created," the former rebel said. "The country now lives in a quagmire, and that is because our government is weak."

For Mihirig, the electricity minister turned negotiator, progress is slow but steady.

"It will be a long way before Libyans realise the importance of building democracy, of building a state, and that using arms is not an option anymore," he said. "The next three to five months are very critical for Libya and will define where the state will go."

 -Reuters