TUNIS Tunisia's ruling Islamist party and the opposition began talks on Friday to form a caretaker government and prepare for elections under an agreement to end months of unrest in the country that inspired the "Arab Spring" revolts.
The North African nation has been in turmoil since July when the assassination of an opposition leader ignited anti-government protests that threatened to derail a democratic transition once seen as a model for the region.
Moderate Islamist party Ennahda has agreed its government will resign after three weeks of talks to appoint a non-partisan cabinet to govern until elections. The two sides will also decide on a vote date and appoint an electoral commission.
"The train out of this crisis is on the tracks, and we are now on the way to finishing our transition to elections," Ennahda chairman Rached Ghannouchi told reporters.
Tunisia's post-revolt path has been less violent than those of its neighbours: Egypt's military ousted an elected Islamist leader and Libya fragile government is powerless against former militiamen who rebelled against Muammar Gaddafi.
But since the fall of its autocratic leader Zine al-Abidine Ben Ali, Tunisia has seen a growing split between Islamists and their opponents over the place of Islam in one of the Muslim world's most secular countries.
The assassination of two opposition leaders by Islamist militant gunmen this year enraged government critics who blamed Ennahda for being two lenient on hardliners.
Once suppressed under Ben Ali, conservative Salafists have become more influential in spreading their hardline message in a state based on strict Islamic law. For many secular Tunisians that threatens liberal education and women's rights.
The deaths of seven Tunisian policemen on Wednesday in clashes with Islamist militants inflamed tensions and forced a brief postponement of negotiations scheduled for that day.
Deep distrust between Ennahda and the opposition was clear in the protracted wrangling before the talks, and that could still upset negotiations.
Fearing the Islamists want to cling on to power, opposition leaders demanded a written commitment from Prime Minister Ali Larayedh that his ruling party would resign at the end of the three weeks of talks.
Ennahda has agreed to step down, but Islamists want to see work on the country's new constitution finished, the appointment of an electoral committee to oversee a vote and a clear date set for elections.
After the July murder, opposition members of a national assembly finishing the new constitution walked out in protest. Weeks later the assembly was suspended.
"This is the end of the crisis. The assembly members should be able to return tomorrow or Monday to finish their work on the constitution," said Nejib Chebbi, an opposition leader.
Talks will likely first name a transition prime minister to lead the non-partisan government. Most of the candidates are economists and former central bank officials.
Deciding the date of the election will be more complicated. Ennahda has said elections will happen in six months, but the opposition may push for a later date to give its leaders more time to prepare.
Ennahda won 40 percent of the seats in Tunisia's first post-Ben Ali vote to elect the assembly, and it has shared power in a coalition with two smaller secular parties as part of an initial transitional agreement.
During its term in power its popularity has slipped, Tunisians say, with many blaming its government for failing to create jobs and keep living costs under control.
But the Islamist party, whose leaders spent years in exile or in prison under Ben Ali, is still the most well-organised political movement in Tunisia. Its main rival is Nida Tounes whose ranks include former Ben Ali officials.
(Reporting by Tarek Amara; writing by Patrick Markey; editing by Barry Moody, Ron Askew)