Libyans headed to the polls today for the first time in over 40 years, electing a national assembly that will play a caretaker role, while a Constitution gets written and the country moves forward in the wake of the overthrow of Moammar Gadhafi.

Voters risked violence to vote in the elections, where thousands of candidates vied for spots in the assembly.

“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 shooting here in the capital of the country’s eastern region came mostly from protesters hoping to stop the vote. They fear the new 200-member congress it will elect might favor the more populous west around Tripoli and allow it to dominate the writing of a constitution. In recent days, protesters have attacked polling stations and burned ballots here and in other eastern cities.

This is actually a major problem in the election. The assembly’s apportionment is based specifically on population, but protesters in Benghazi wanted to divvy up candidates directly among the east, west and south. Paradoxically, that would help the relatively unpopulated south more than anyone; Benghazi would get a mere six more representatives (from 60 to 66) in that outcome, while the south would get almost double the representation relative to their population. But protesters in Benghazi, the heart of the revolution, are apparently willing to take down the country’s promise for six measly representatives.

And it’s not clear what these representatives will even do. The national assembly will have nominal control over the country, but they will not choose a smaller group to write the Constitution. That constituent authority will be elected in a separate vote, with an even representation from each region (perhaps as a way to simmer tensions from Benghazi). So this new Parliament will elect a Prime Minister, but the rules under which it would govern will not become known until after the Constitution is written by a different entity.

Nevertheless, it’s one of those joyful days where we see hopeful images of crowds voting, in this case amid much peril, in the Middle East, choosing a brighter future than one consumed by tyranny and dictatorship. But the early jockeying among the regions show the challenges ahead for Libya.