TUNIS, Tunisia (AP) — Nearly all of Tunisia's feuding political parties on Saturday signed on to a roadmap designed to break their months-old impasse and put an end to the country's drawn-out democratic transition.

Most of the Islamist-led ruling coalition a well as parties in the largely secular opposition agreed to begin a dialogue on replacing the current government with a technocratic body to supervise new elections. That new body is expected to be in place in about a month.

"I am optimistic for the future of Tunisia and that the dialogue process will lead to free and transparent elections," President Moncef Marzouki said at the signing ceremony. "The eyes of Tunisians and our friends abroad are on us and we cannot disappoint them — it is an historic responsibility."

Tunisians kicked off the Arab Spring revolutionary movements in January 2011 by overthrowing their long-serving dictator and then, nine months later, voting the moderate Islamist Ennahda Party into power.

The transition, which comes as a new constitution was being written, has not been easy — the country has suffered terrorist attacks, witnessed the rise of aggressive ultraconservative Islamist groups and seen its economy spiral downward.

The assassination of a leftist politician in July, the second such killing in five months, prompted widespread protests, a walkout by opposition lawmakers and calls for Ennahda to step down for failing to ensure security. The Islamist party and its two secular coalition partners finally agreed to step down in favor of a technocratic government.

The new roadmap, however, calls for the Ennahda-dominated assembly to finish writing the constitution in a month, set up the commission to supervise elections and pass an electoral law.

Parliamentary and presidential elections are not expected until early next year.

Saturday's ceremony started three and a half hours late after Ennahda and other members of the coalition refused to sign the roadmap stipulating the government's resignation, preferring to await the results of the dialogue. In the end, all parties except for the left-of-center Congress for the Republic, which is part of the ruling coalition, signed the document committing the government to resign once the technocratic body is set up.

Mediators expressed confidence that the differences would be resolved before talks began next week.