Although voting took place peacefully across much of the country, armed gangs in Benghazi stormed a polling station and set alight ballot papers. Two other polling stations were attacked, with one man shot in the arm. There were similar incidents in the eastern coastal towns of Guba and Suluq, where fighters stopped ballot papers being delivered.
However, in the capital, Tripoli, and other cities thousands queued from 8am to vote, the overwhelming majority for the first time.
Libya's last election took place in 1964 under King Idris al-Senussi, the monarch Gaddafi ousted five years later at the point of a rifle.
Many residents were overwhelmed at the opportunity to vote. "I'm so excited. I woke up at six this morning, before my daughters," said Mabroka Amar (69) at a polling station in Tripoli. She said that she dimly remembered last voting almost half a century ago, adding: "A new country has been born. God willing, I will be alive to vote again and again."
The mood across the capital was festive. Residents waved the red, black and green revolutionary colours and honked their car horns. Several hundred gathered at Martyrs' Square, in the centre of the city, and kissed the ground. Others posted photographs of their fingers — dyed purple by officials after voting — on Facebook. One jokey doctored version showed the late Gaddafi also voting.
Many said that the idea of taking part in an election had previously been little more than fantasy, with Gaddafi a vehement opponent of parliamentary democracy. "I'm 35 years old. I've never voted. The devil was with us from 1969. This is like the first man on the moon," said Ali Ilhouri at Tripoli's Allassma high school, which was serving as a polling station.
He dismissed the federalist protesters in Benghazi and eastern Libya as a relatively small group of "mad fanatics". He said: "I was born in Benghazi. There are lots of other peaceful ways to protest in this election. It isn't civilised."
The federalists are deeply unhappy at the distribution of seats in the new national congress. The outgoing National Transitional Council allocated seats on the basis of population numbers, with 100 going to the west, 60 to the east and 40 to the south. The federalists say that the regions should have a third each.
'No one in the government is listening to us'
The revolution has reignited Benghazi's long-standing feelings of marginalisation and injustice, fuelled by the city being the first to rise up against Gaddafi on 17 February last year.
On Friday, armed groups shut several important eastern oil terminals in protest. They also used anti-aircraft guns to fire on a helicopter carrying election materials, forcing it to land and killing a 22-year-old election volunteer.
"The country will be in a state of paralysis from now on because no one in the government is listening to us," Hamed al-Hassi, a defiant former rebel who now heads the high military council of Cyrenaica, the name for the eastern region, told Reuters.
The national election commission in Tripoli admitted that some election material had been "destroyed" in Benghazi. But it said that polling had gone ahead in 94% of voting centres — 1 453 out of 1 554 — with officials trying to deliver new ballot papers where the security situation allowed.
Against expectations, voting was a success across the south, it said, including in the remote south-eastern town of Kufra, the scene of vicious fighting between Arab Zuwayy and black Toubou forces. Two polling stations for Toubou were functioning, said the commission.
A spokesperson for the interior ministry, Araaf al-Hoja, admitted that it was hard to stop federalist gunmen from "violating" polling stations. "Unfortunately we know many people have weapons," he said. "But overall the security situation is very good."
Western leaders praised the election, with the US senator John McCain on a visit to Tripoli, and British foreign secretary William Hague tweeting enthusiastically that the vote was a "historic moment and achievement after much suffering".
Results will not be known for several days. The Muslim Brotherhood's Justice and Development party is expected to do well, with some predicting that Islamists will sweep to power, as they have done in post-Arab spring elections in neighbouring Tunisia and Egypt.
On Saturday, however, many voters said that they had instead supported Mahmoud Jibril, a pragmatic moderate and Libya's former interim prime minister until his resignation in October. His political coalition, the National Forces Alliance, appears to enjoy broad appeal, especially in the capital and with younger and more educated voters. Some expect him to win by a landslide.
"I voted for Jibril. He has a reasonable image. He favours knowledge rather than ideas. He wants the country to advance," said Othman Bashir, a surgeon who spent 10 years in the UK. Bashir, who had brought his teenage son along to witness the voting, added: "People are more polarised in England. Labour is Labour and Conservative is Conservative. For us, it's all new." – guardian.co.uk © Guardian News and Media 2012