African state has struggled with divisions since the ousting of former president Zine Al Abidine Ben Ali in 2011
Tunisia's Islamist-led government agreed on Saturday to resign after talks with secular foes to form a caretaker administration and prepare for elections to safeguard the democratic transition in the country where the Arab Spring uprisings began.
The talks, which could begin next week, aim to end weeks of deadlock between the governing coalition and secular opposition that has endangered prospects for stable democracy almost three years after Tunisians toppled autocrat Zine Al Abidine Ben Ali.
The crisis, which erupted in July after the killing of an opposition leader by suspected Muslim militants, has eroded an already fragile financial outlook and unnerved the North African country's international lenders.
Tunisia's powerful UGTT labour union, mediating between the sides, proposed three weeks of negotiations after which the Islamist Ennahda would yield to an non-partisan administration with a date for parliamentary and presidential elections.
"The dialogue will start on Monday or Tuesday," Lotfi Zitoun, a senior Ennahda party official, told Reuters. "Ennahda has accepted the plan without conditions to get the country out of the political crisis."
The UGTT confirmed the agreement and called on both sides to set a time to begin talks next week.
Since the street revolt that ousted Ben Ali in January 2011, Tunisia has struggled with divisions over the political role of Islam in one of the Muslim's world's most secular countries.
The July assassination brought the secular opposition onto the streets to demand the fall of a government that critics accused of being lax with Islamist militants and wanted to impose an Islamist agenda.
Tunisia's evolution towards democracy has been generally peaceful compared to Egypt, where the army overthrew an elected Islamist president after mass protests against his rule, and neighbouring Libya, where the central government is struggling to curb the influence of rival militias.
In contrast, Ennahda shared power in a coalition with two secular junior partners and had sought to defuse worries that it could impose an strict Islamist programme impinging on liberal education and women's rights.
Many opponents, however, believe Ennahda has mismanaged the economy and gone easy on hardline Islamists blamed for attacks on secular Tunisians. Critics believe Ennahda had been only playing for time to shore up its position before elections.
But the party itself was split between moderates and relative hardliners who called for sharia (strict Islamic law) to be enshrined in the new constitution of a country of 11 million that relies heavily on secular European tourism.
Both sides agreed on the need for negotiations, but talks could still struggle to overcome differences over the role of a constituent assembly writing the new constitution, over a new electoral law and the date for elections.
Many Tunisians are especially worried about the high cost of living and the economic fallout from the political crisis.
Ennahda remains the most coherent Tunisian political force but its public support has waned as the crisis has festered.
But the party, which won around 41 percent of the seats in the constituent assembly in October 2011, is still popular and organised enough to have mustered 100,000 supporters for a street march in August.
The opposition is a mix of Nidaa Tounes, a secular party filled with former regime officials, and smaller leftist parties. But Nidaa leader Beji Caid Essebsi, a former pro-regime businessman who served a stint as prime minister after Ben Ali's fall, has emerged as an important opposition figure.