BENGHAZI, Libya — Defying expectations and in some places bullets, Libyans across most of their country voted on Saturday in their first election after more than four decades of isolation and totalitarianism under Moammar Khadafy.
‘‘We will vote for the fatherland whether there is shooting or not,’’ said Naema el-Gheryiene, 55, fixing a designer veil over her hair as she walked to a polling station in an upscale neighborhood here shortly after a gunman in a passing car sprayed bullets into the air. ‘‘Whoever dies for their country is a martyr, and even if there are explosions, we are going to vote.’’
The voting was far from immaculate. Violent protests forced the closure of several eastern polling stations, and at least one man was killed in election-related violence in Benghazi.
But given the low expectations after nearly nine months of lawlessness since the killing of Khadafy, the orderly voting in much of the country surprised even the voters themselves. As the polls closed, election officials said the turnout was 60 percent and vote-counting began. Results are not expected for several days.
Many people had braced for chaos, if not civil war, as Libya prepared to go to the polls with its cities controlled by fractious militias.
Violent attacks on polling centers across the east have been carried out by protesters determined to thwart the election for fear of domination by the country’s western region.
Almost no one can remember the parliamentary elections once held under the monarchy that preceded Khadafy’s 1969 coup, and a vast majority of Libyans were born after he had eviscerated any civic organizations or national institutions, except perhaps the secret police.
‘Who would have predicted a year ago that there would even be elections?’
But in some ways their inexperience proved an unexpected blessing, argued Diederik Vandewalle, a Libya scholar at Dartmouth University who is in Tripoli for the vote. Neighboring Arab Spring revolts in Egypt and Tunisia have struggled to overcome the resistance of holdover institutions like the police or the military, and polarizing divisions between Islamists and liberals.
But Libyans were inventing a new nation virtually from scratch.
After warning throughout last year’s revolt of a possible descent into Somalia-like chaos of tribal infighting after the removal of Khadafy’s iron fist, Vandewalle said the organizing of the vote had proven him wrong, at least so far. ‘‘Who would have predicted a year ago that there would even be elections?’’ he asked.
The interim government’s election commission said that voting had taken place as scheduled in 94 percent of the nation’s polling centers despite a tribal strike and sporadic protests, and by 4 p.m., at least 1.2 million, or 42 percent, of Libya’s eligible voters had cast ballots.
Libyans in the major coastal cities of Tripoli, Misurata, and Benghazi celebrated by jamming the streets with their cars, honking madly and waving out the window the ink-stains used to mark the right forefingers of each voter.
Still, even amid the jubilation — joined in many places by the artillery-mounted pick-up trucks of the young militiamen who are both the source of Libya’s tenuous security and its scourge — there were many reminders that the vote was just the beginning of the struggle to erect new institutions of government.
The vote will select a 200-member congress that was initially expected to govern the country for 18 months while it drafted a constitution. But attempting to placate the protests of easterners that the congress would be stacked in favor of the more populous west around Tripoli — about 100 members will be elected from the west, 60 from the east, and 40 from the desert south — the interim National Transitional Council stripped the congress of its authority over the constitution just two days before the vote.
Instead, the council decreed a new election to choose a smaller panel to draft the constitution that would be composed of equal numbers from each region.
The last-minute decree all but guarantees that the first moves by the new congress, whose members campaigned to be part of a constitutional assembly, will be to challenge the new plan and with it the legitimacy of the rest of the ground rules put in place by the self-appointed transitional council.
The council has pledged to dissolve itself at the seating of the new congress, which is expected to choose a prime minister to head the government.
Violence aimed at stopping Saturday’s vote also underscored that regional resentments will surely bedevil the new congress just as they did the transitional council.
In the days leading up to the vote, protesters angry at the distribution of seats in the congress have attacked polling stations and burned ballots here and in other eastern cities. On Friday night, they downed a Libyan air force helicopter carrying voting supplies, killing an election official.
And on Saturday fresh attacks on election facilities across the east damaged election materials in as many as three polling centers in Benghazi and forced the closure or consolidation of several polling centers in the coastal area around the city of Ajdabiya as well.