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's fragile government seems impotent against many groups of powerful former militiamen, who overthrew former ruler Muammar Gaddafi.
But since the fall of 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.
On Thursday residents ransacked two Ennaha offices and took to the streets to demand the government quit.
Two months ago Ennahda began a crackdown on local Islamist group Ansar al-Sharia, which it branded a terrorist organization suspected of killing the two opposition leaders.
"END OF CRISIS"
"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.
But deep distrust between Ennahda and the opposition was clear in the protracted wrangling before the talks, and that could still upset negotiations.
Talks will likely first name a transitional 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 the 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.