Libyans took to the streets Friday to celebrate the first anniversary of the uprising that toppled Muammar Gaddafi, but some rued the insecurity and disorder that still stalk a country preparing for its first free election.

Flag-waving crowds converging on Martyrs Square in the capital Tripoli or Freedom Square in Benghazi, cradle of the revolt, had to negotiate extra checkpoints set up to stop Gaddafi loyalists from disrupting festivities.

Spontaneous celebrations began Thursday night when men, women and children emerged on the streets of Tripoli, Benghazi and other towns waving the red, black and green flags of Libya's ruling National Transitional Council (NTC) and chanting.

At Gaddafi's old Tripoli compound, now reduced to rubble, NTC flags dotted the derelict landscape. Several homeless families have moved into the few buildings still standing.

Before it was him (Gaddafi), and the people were weak, said a mother of three, who moved in last month and gave her name only as Basmah. Now, we are equal.

Hundreds of flags flew from balconies and cars. Bunting hung across the capital's streets as well as from the balcony on Martyrs Square where Gaddafi used to speak publicly.

Life for many people has improved since the eight-month NATO-backed struggle against Gaddafi and its chaotic aftermath, but security and political woes abound ahead of the June poll.

Despite the problems that remain in the country, this is an amazing day and we want to celebrate, a 22-year-old engineering student called Sarah said in Tripoli. Just look at what was achieved in this past year.

As it tries to build a democratic state, the NTC is struggling to impose its authority on a country awash with weapons and to form a national police force and army.

Heavily-armed militias have stepped into the vacuum, carving out local fiefdoms. Their fighters say they are loyal to the NTC but answer only to their own commanders. They often clash because of disputes over who controls which neighbourhoods.

Ezzieddin Agiel, who teaches engineering at Tripoli University, said insecurity could undermine the June election.

The biggest achievement of the revolution was to end the Gaddafi regime and put a stop to his family's corruption. The elections reflect the Libyan quest to build the state and constitution, he added.

The weakness of the political institutions may lead to serious problems for Libya, which may be difficult to control.

CHALLENGES AHEAD

There is no shortage of tensions.

Old animosities rooted in Libya's tribal past have fused with newer anxieties about land and power, and militia turf battles have at times threatened to spin out of control.

The aspirations of Islamists for a more religious society, heavily suppressed by Gaddafi, are also surfacing.

As well as imposing order, the government must rebuild an aging and damaged infrastructure and bolster weak health, judicial and educational systems in the oil-producing country.

Libya's new rulers have not organised official celebrations at a national level, as a mark of respect for the thousands of people killed in the conflict that ended with Gaddafi's capture and killing on Oct 20. However NTC chairman Mustafa Abdel Jalil is expected to appear in Benghazi for the occasion.

Celebrations in Benghazi, the city which first rose against Gaddafi's 42-year rule, began Wednesday evening with a torch-lit march to recall the first protest a year ago.

The NTC says die-hard Gaddafi loyalists might disrupt the anniversary, but perhaps the biggest risk in Benghazi is from protests by disgruntled supporters of the anti-Gaddafi revolt.

Last month, Abdel Jalil was confronted in Benghazi by a furious, bottle-throwing crowd who complained the NTC was trashing the values of the revolution because it was not transparent about how it spent oil revenues and included officials who had served under Gaddafi.

The NTC seems incapable of addressing growing popular anger aimed at it and its chairman Mustafa Abdel Jalil over the transition process, said Crispin Hawes of the Eurasia Group consultancy.

February's uprising began in the long discontented east of Libya around Benghazi, inspired by unrest that overthrew leaders in neighbouring Tunisia and Egypt, and then ground slowly across the country before the sudden fall of Tripoli in August.

Gaddafi was killed two months later when he was found hiding in a storm drain after fleeing an attack on his home town of Sirte. Grainy mobile phone footage of his last moments, bloodied and bewildered as rebels dragged him along a road, recorded the grisly climax of the conflict.

Several of Gaddafi's children are in exile in neighbouring countries, from where some have made so far fruitless appeals for a counter-revolution. The most prominent son, Saif al-Islam, who at one stage was tipped to succeed his father, has been held by a militia in the Libyan town of Zintan since he was captured disguised as a Bedouin tribesman deep in the Sahara desert.

Highlighting the weakness of Libya's central government, local commanders have so far refused requests to hand him over to the authorities in Tripoli.

(Additional reporting by Ali Shuaib; Writing by Marie-Louise Gumuchian; Editing by Alistair Lyon)