TUNIS, Tunisia (AP) — Tunisia's governing Islamist party has agreed to resign in favor of a caretaker government in an attempt to resolve a political crisis that has paralyzed the country, officials said Saturday.

The assassination of a left-wing politician at the end of July — the second in five months — was the turning point for the country's disgruntled opposition, which pulled its deputies out of parliament and staged a string of protests across the country.

The opposition also faulted the governing Ennahda Party for ignoring a rising trend of Islamic radicals, some of whom attacked the U.S. Embassy in Tunis last year. But the government has since cracked down on these groups, throwing many of their members in jail.

Tunisia kicked off the Arab Spring by overthrowing its long-ruling dictator, Zine El Abidine, but its transition to democracy has been dogged by terrorist attacks, a struggling economy and widening divisions between Ennahda and the opposition.

After the second assassination, the UGTT, the country's main labor union, together with other members of the civil society, mediated between the government and the opposition for two months to bring the transition back on track.

"It is a positive development for Ennahda, which has accepted the plan without reserve or conditions, and which will clear the impasse," Bouali Mbarki, the deputy head of the union, said Saturday. He said his union has a written statement from Ennahda about that, and opposition officials also confirmed the agreement.

The road map set forward by the negotiators has Prime Minister Ali Larayedh's government resigning in three weeks as negotiations go forward on the section of an apolitical figure to replace him and an interim, non-partisan government.

Meanwhile, the legislators boycotting the Assembly will return to work and finish the constitution over the next four weeks.

An election commission also will be set up to fix a date and organize presidential and legislative elections in the coming months.

With a military coup in Egypt and neighboring Libya awash in rival militias, Tunisia has been closely watched to see if its post-Arab Spring transition can succeed.

Despite attacks by terrorists, a rising extremist trend and an often acrimonious political debate, Tunisia's politics have been marked by comprise and concessions between factions.

Political analyst Salaheddine Jourchi said Ennahda's decision shows that it realized its rigid position against a caretaker government was getting it nowhere and the balance of forces in society was against it.

"This concession is the result of pressure exerted by the opposition and civil society," he said. "It allows Ennahda to take stock of itself and put its house in order because its image has been badly affected recently."

He also noted that the constitutional assembly which is dominated by Ennahda, will remain until the new elections, still giving a strong say in the transition.