* Insecurity a concern a year after Gaddafi's ouster
* Uncertainties make investors wary
* Central government struggles to rein in militia
* Fighting in former Gaddafi bastion
By Hadeel Al Shalchi and Marie-Louise Gumuchian
BENGHAZI/TRIPOLI, Oct 22 (Reuters) - Insecurity blights Libya, where militias still call the shots a year after they toppled Muammar Gaddafi, keeping foreign investors wary and clouding the oil-producing country's future.
Last month's attack on the U.S. consulate in the eastern city of Benghazi, in which U.S. ambassador Chris Stevens and three other Americans died, underlined the fragility of a state struggling to emerge from the legacy of Gaddafi's 42-year rule.
Libyans rose up against their leader during a wave of Arab revolts against entrenched rulers in early 2011, but they had to fight to remove him, with the help of a NATO bombing campaign.
Most Libyans remain delighted that Gaddafi has gone and many voice cautious optimism about their country's prospects.
But a year on, chaos still dogs the North African nation, as Shehata Awami, Benghazi's first elected governor can testify.
He quit after three months, caught between daily pressure, often backed by armed threats, from people demanding jobs or housing and a weak, unresponsive central government in Tripoli.
"Once, several council members called me shaking with fear. A man demanding a house had told them: 'If I don't get what I want, I will walk into your building with two suitcases of explosives and blow all of you up'," Awami said.
"Every couple of weeks I would send delegations to Tripoli to meet the government and ask for aid," he said. "And every time we were told: 'Later, tomorrow, we can't help now'."
Shehata resigned in August to go back to his banking job.
Discontent is rife across Libya, not just in Benghazi, the cradle of the revolt. Gun culture has taken hold, residents say, citing carjackings, kidnappings, armed robberies and disputes leading to shootouts between rival groups.
The latest fighting around the former Gaddafi stronghold of Bani Walid shows deep divisions persist. Tripoli often accuses Gaddafi loyalists of trying to destabilise its democratic path.
The government has failed to control the militias, most of them ex-rebels. Even worse, it relies on them for security, with the fledgling police and army unable to stamp out militia feuds, control Libya's borders or rein in hardline Islamist militants.
"Ultimately, the longer these groups continue to perform security tasks which should be the responsibility of Libyan state security forces, the more difficult it will become to demobilise them or integrate them into the army," said Torbjorn Soltvedt, senior analyst at risk consultancy Maplecroft.
While some militias have gone back to their home towns or merged into security forces, others still wield power.
Many are technically part of the Supreme Security Committee (SSC), set up in September last year to try to regulate armed groups that saw themselves as guardians of Libya's revolution.
Tripoli local council official Sadat Elbadri, who previously handled fighters' affairs, said the SSC was conceived as a temporary solution to organise armed civilians who were suspicious of Gaddafi-era security institutions.
But corruption and mismanagement of public money took their toll as people scrambled for the weapons, cars and privileges accorded to supposedly frontline fighters, Elbadri said.
"In Tripoli, we started with 30,000 revolutionaries. Now there are 100,000. Where did these people come from?" he asked. "Even women signed up, saying they used to cook for the fighters so they must be considered revolutionaries and get salaries."
Apart from draining public finances, the SSC has also become a security headache, threatening to eclipse its creator and paymaster, the Interior Ministry, Elbadri said.
SSC members, still loyal to their brigade leaders, have been involved in kidnappings and intimidation, even allowing armed Islamic militants to smash a Sufi shrine in broad daylight.
The Interior Ministry has repeatedly promised to disarm the SSC, but this has not happened, to the disgust of many Libyans.
Building on popular protests that swept an Islamist militia out of Benghazi after the assault on the U.S. consulate, the government has taken a twin-track approach, shutting down rogue groups, but licensing many of the most powerful armed brigades.
This appears to have done little to enhance security or central government authority over the ill-disciplined fighters or the militia leaders, many of whom are hardline Islamists.
"On the day Benghazi residents tried to run the brigades out, weapons were stolen from the bases and dispersed into the city," said Ahmed Zlitan, a former rebel brigade leader and SSC member. "Security in Benghazi is much worse now than before."
He blamed the Interior Ministry for failing to re-organize the police force or properly train fighters to join it.
Former rebels often take matters into their own hands, as in this month's assault on Bani Walid, a former Gaddafi stronghold, by militias aligned with the Defence Ministry.
"The government has failed to secure Libya," Tripoli militia leader Abu Abdelrahman Al-Sharif told Libya television recently. "We won't stop until we cleanse Bani Walid."
Lingering security fears have kept foreign investors cautious about Libya despite vast opportunities and the oil wealth to pay for urgent reconstruction needs.
Foreign firms have yet to bring back all their expatriates. Many businessmen travel with security advisers.
Oil companies were the first to return to Libya last year, helping restore output close to pre-war levels of 1.6 million barrels per day. But in some cases they have faced payment demands from former rebel fighters guarding oil installations.
"Investor confidence is unlikely to improve significantly until greater progress has been made towards establishing a legitimate and strong central authority capable of addressing the country's security concerns," Maplecroft's Soltvedt said.
Libya took a major step towards democracy in July by holding its first free election for the general national congress (GNC), but a government has yet to gain the GNC's approval.
Prime Minister-elect Ali Zeidan is trying to form a broadly acceptable cabinet after his predecessor, Mustafa Abushagur, was dismissed this month after failing to win a confidence vote.
"These are first lessons in a democracy. We are going through them very early. Gradually we will achieve progress," Najib el-Hassadi, a Libyan university professor, said.
"The government needs support. We don't want a repeat of what happened to Abushagur. We don't want a political vacuum."
But disarming militias and rebuilding the security forces are vital to buttress Libya's nascent political process.
"Confidence in political institutions, reconciliation between different communities and progress in the transitional process are all prerequisites to any tangible improvements in security conditions," said Control Risks analyst Henry Smith.
For now, security remains the top concern of many Libyans.
"I think Libya, especially Benghazi, is going into the unknown due to the security vacuum, which is reflected clearly in those policemen-free checkpoints," said Alaa Elbaba, a 23-year old electric engineering student from Benghazi.
"Yesterday I saw a young man, perhaps around 17, oiling his gun in public. No one was paying any attention to him."