Jubilant Libyans chose a new parliament in their first free vote in decades, but violence and protests in the restive east underscored the challenges ahead as the oil-rich nation struggles to restore stability.

Women ululated while men distributed sweets and the elderly with walking sticks or wheelchairs struggled to get to polling centres in a show of joy over the most visible step towards democracy since dictator Muammar Gaddafi was killed by rebel forces last October after months of bitter civil war.

"Look at the lines. Everyone came of his and her own free will. I knew this day would come and Gaddafi would not be there forever," said Riyadh al-Alagy, a 50-year-old civil servant in Tripoli.

"He left us a nation with a distorted mind, a police state with no institutions. We want to start from zero."

But attacks on polling centres in the east - where anger over perceived domination by rivals in the west is fuelling a drive for autonomy - laid bare the rifts threatening to tear the nation apart.

Still, the election for a 200-seat parliament, which will be tasked with forming a new government, was the latest milestone in a revolution stemming from the Arab Spring revolts that led to the successful ousting of authoritarian leaders in Tunisia, Egypt and later Yemen.

Nearly 2.9 million Libyans, or 80% of those eligible to vote, have registered for the election and more than 3,000 candidates have plastered the country with posters and billboards. Electoral officials said turnout was 60% and counting of the ballots had begun.

"We are celebrating today and we want the whole world to celebrate with us," prime minister Abdurrahim el-Keib said after he cast his vote in Tripoli.

As they did in Egypt and Tunisia, Islamists also hope to rise to power in Libya where they were long repressed under Gaddafi's secular rule. That would leave conservative religious parties with influence over a large and uninterrupted chunk of territory that stretches from Israel's southern border in Egypt to Tunisia.

One of the main contenders in the race was the Muslim Brotherhood's Justice and Construction party, which has led one of the best organised and most visible campaigns.

Three other parties also expected to perform well were former prime minister Mahmoud Jibril's secular Alliance of National Forces; former jihadist and rebel commander Abdel-Hakim Belhaj's Al-Watan; and the National Front, one of Libya's oldest political groups.

US senator John McCain, an Arizona Republican, gave the election a clean bill of health during a visit to Tripoli.

"Turnout is very high, polls crowded and people are obviously enthusiastic. Overall it is a successful operation," he said.

The triumphant mood capped a rocky transition as interim leaders have largely failed to rein in armed militias and provide security while deepening regional and tribal disputes erupted into bloodshed with alarming frequency.

The new parliament is itself temporary and must form a new government that will take over until a constitution is drafted so fresh elections can be held next year.

Yesterday's violence - one person was killed and two wounded in the country's east - reflected fears that the country was descending into lawlessness and could face years of instability.

Many Libyans hoped their desert nation of six million could become a magnet for investment and thrive. But divisions left by Gaddafi's paranoid 42-year rule, which pitted neighbour against neighbour, town against town and tribe against tribe has proved hard to overcome.

Gaddafi banned political parties and considered democracy a form of tyranny. He governed with his rambling political manifesto, the "Green Book", which laid out his vision for rule by the people but ultimately bestowed power in his hands alone.

The last parliamentary election in Libya was in 1964, five years before Gaddafi's military coup that toppled the monarchy.

The outcome of yesterday's vote could give an indication whether Libya will become a united nation keen on rebuilding and moving away from its dark past, or fracture along regional, tribal and ethnic lines.

"This election will tell us whether Libya will turn into another Lebanon," said political analyst Fathy Bin Essa, alluding to the Arab nation wracked by a 1975-90 civil war.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.