Jubilant Libyan voters marked a major step toward democracy after decades of erratic one-man rule, casting their ballots on Saturday in the first parliamentary election after last year's overthrow and killing of long-time leader Muammar Gaddafi. But the joy was tempered by boycott calls, the burning of ballots and other violence in the country's unsettled east.

In the capital, Tripoli, residents turned out in droves to cast votes for the 200-seat legislature. Lines began to form outside polling centres more than an hour before they were scheduled to open. Policemen and soldiers were guarding the centres, searching voters and election workers.

"I have a strange but beautiful feeling today," said Adam Thabet, a dentist, waiting outside a polling centre. "We are free at last after years of fear. We knew this day was coming, but we were afraid it could take long to come."

After casting his ballot in a station in the capital, the prime minister, Abdurrahim el-Keib, said: "We are celebrating today and we want the whole world to celebrate with us."

Libya's election is the latest fruit of Arab spring revolts against authoritarian leaders. It is likely to be dominated by Islamist parties of all shades, a similar outcome to elections held in neighbouring Egypt and Tunisia, which had had their own, much less bloody uprisings.

There are four major contenders in the race, ranging from a Muslim Brotherhood-affiliated party and another Islamist coalition on one end of the spectrum to a secular-minded party led by a western-educated former rebel prime minister on the other.

"This is history in the making," declared Farid Fadil, a 26-year-old medic, as he waited to vote outside a polling centre in Tripoli. "We were ruled by a man who saw himself as the state."

Libya's intense regional, tribal and ideological divisions have cast a shadow over the vote, however. In the oil-rich east there is a thriving pro-autonomy movement fuelled by widespread resentment at what is perceived as domination by Tripoli.

Some easterners back a boycott of the election and on Saturday protesters torched ballot boxes in 14 out of 19 polling centres in the eastern town of Ajdabiya, according to the former rebel commander in the area, Ibrahim Fayed.

Nouri al-Abar, the head of the election commission, told a news conference that 94% of polling centres nationwide were open but acknowledged that "security conditions" had prevented ballots from reaching some polling centres in some cases, and that ballots had been destroyed in other cases. He did not provide further details on how the ballots had been destroyed.

But in Tripoli voters celebrated. Libyans flashed the V for victory sign as they entered polling centres. Motorists honked their horns as they drove past to greet the voters lined outside. Others shouted "Allahu akbar", or "God is great", from their car windows.

"The turnout is extraordinary," said Mohammed Shady, an election monitor. "Everyone is being very co-operative. They want the day to be a success and it will be."

The election lines brought together women, men and children accompanying their parents. There were women in black abayas, or robes, bearded men, elderly men and women using wheelchairs or canes. Some voters arrived at polling centres waving the Libyan red, green and black flag or wrapping it around their shoulders.

Voters distributed sweets and women hugged each other or sang as they waited in line. Others chanted: "The martyrs' blood will not go in vain," a reference to the thousands of rebels killed by Gaddafi's forces. Others held pictures of loved ones killed in last year's ruinous civil war.

"Look at the lines. Everyone came of his and her own free will. I knew that 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," he said, as a woman came out of the polling centre ululating and flashing a finger daubed with the purple ink used to prevent multiple voting.

Saturday's vote is a key milestone in a nine-month transition toward democracy for the country after a bitter civil war that ended Gaddafi's four-decade-long rule. Many Libyans had hoped the oil-rich nation of six million would quickly thrive and become a magnet for investment, but the country has suffered a virtual collapse in authority that has left formidable challenges. Armed militias still operate independently, and deepening regional and tribal divisions erupt into violence with alarming frequency.