(Reuters) - Tunisia will vote on Sunday in its first democratic election which could set the template for other Arab countries emerging from the "Arab Spring" uprisings.
The North African country, which overthrew President Zine al-Abidine Ben Ali in January, is choosing an assembly which will have the task of writing a new constitution, installing a temporary executive and setting a fresh round of elections.
Below are details on how the election will work and what is likely to happen after Tunisians have made their choice:
President Zine al-Abidine Ben Ali fled to Saudi Arabia on January 14 in the face of mass protests, and his rubber-stamp parliament was dissolved soon after. That has left Tunisia with no elected institutions, just an unelected caretaker government. The new assembly is designed to start the job of building the country's democratic institutions.
Since its independence from France in 1956, Tunisia held elections but they were not truly free. A number of opposition parties were banned from taking part. Those that were allowed on the ballot paper were often supporters of the ruling party masquerading as opponents to create the illusion of democracy. Any genuine opponents taking part were harassed by the police. The interior ministry, which counted the votes, made sure they only got a handful of seats.
Sunday's election has candidates which reflect the spectrum of Tunisian society -- including Islamists who were banned under Ben Ali. The vote is also being organised by an independent commission for the first time. In another first, monitors from the European Union have been invited to observe the vote.
* The election will be run according to a system of proportional representation.
* The country is divided into 33 electoral districts, 27 in Tunisia itself and 6 for Tunisians resident overseas. In each district, a maximum of 10 seats for the assembly is up for grabs. The total number of seats in the assembly is 217.
* In each electoral district, parties put forward a list of candidates. Voters will cast their ballot for the list they favour, not for the candidates.
* Each time a party list gets over a certain threshold of votes, in most cases 60,000 votes, it is awarded one seat in the assembly. If any seats are left over in an electoral district, they are awarded to the list with the next highest number of votes.
* More than 100 parties have registered to take part in the election. There is also a large number of independent lists.
* There are about 7,000 voting precincts. They open at 07:00
(0600 GMT) and close at 19:00.
* Provisional results will be announced late on Sunday, or on Monday, election officials say.
Ennahda, a moderate Islamist party, is likely to emerge with the biggest number of seats in the assembly, according to opinion polls. However, it is not clear if it will have enough to form a majority. If it does not, it will need to form alliances with other parties. Ennahda leader Rachid Ghannouchi has said discussions about this have already begun.
If it is just short of a majority, it may be enough for Ennahda to do deals with small parties and independents. Otherwise, it will have to talk to its bigger rivals. Possible partners include the secularist Ettakatol camp, led by Mustafa Ben Jaafar, and the Congress for the Republic led by Moncef Marzouki, a former dissident who was in exile in France.
Najib Chebbi, leader of the highest-profile secular outfit, the Progressive Democratic Party, has said he will not work with Ennahda. He in turn is trying to assembly an alliance of secularist parties to deprive Ennahda of a majority.
Tunisia already had one such assembly, elected in 1956 to draft a constitution after independence from France. The assembly will, according to Tunisian law, be the country's supreme law-giving and executive body. Beyond that, there are no clear rules on how it will operate and what it will do. Indications from constitutional lawyers, the government and the major parties are that it will do the following:
* It will draft a new constitution. This is likely to include designating new elections for whichever democratic institutions the assembly decides to create. There is no formal time limit, but 11 of the major parties have given themselves a one-year limit to get the job done.
* It will select a new interim president. This is largely a ceremonial post. At the moment it is held by Fouad Mebazaa, who was the head of the upper head of parliament under Ben Ali. The only former Ben Ali associate still in power, he is certain to go. Who replaces him will depend on the outcome of negotiations between the parties with the biggest number of seats in the assembly.
* The president will appoint a new interim government, probably in consultation with the majority in the assembly. The prime minister now is Beji Caid Sebsi, a technocrat who served as foreign minister under Ben Ali's predecessor, Habiba Bourguiba. Diplomats say it is likely he will be replaced. Ministers say they will continue carrying out their duties after the election, until a new government is appointed.
Compiled by Christian Lowe and Tarek Amara