By Tarek Amara
TUNIS (Reuters) - Tunisia's national assembly approved the country's new constitution on Sunday in one of the last steps to establishing full democracy three years after the uprising that toppled autocrat Zine el-Abidine Ben Ali.
Just before the constitution vote, Prime Minister Mehdi Jomaa appointed a caretaker cabinet as part of a deal to end a crisis between Tunisia's Islamist party and its secular opposition until new elections this year.
Tunisia's new constitution and progress contrasts sharply with messy transitions in Libya, Egypt and Yemen which are still caught up in turmoil after ousting their own long-standing leaders in 2011 revolts and uprisings.
After the historic vote, the red and white Tunisian flag was unfurled and assembly deputies embraced, danced and sang inside the chamber in Tunis to celebrate the charter, which has been widely praised for its inclusiveness.
"This constitution was the dream of Tunisians, this constitution is proof of the revival of the revolution, this constitution creates a democratic civil nation," Assembly chief Mustapha Ben Jaafar said.
While the new constitution recognizes Islam as the country's religion, it also enshrines freedom of conscience and belief, and equality between the sexes.
As one of the most secular nations in the Arab world, Tunisia has struggled since the revolt, with divisions over the role of Islam and the rise of ultra-conservative Salafists, who secularists feared would try to roll back liberal rights.
The assassination of two opposition leaders by Islamist militants last year, though, pitched the small North African country into crisis with the ruling moderate Islamist party, Ennahda, under pressure to step down.
Opposition leaders blamed Ennahda for going easy on hardline Islamists who promoted the idea of Islamic state based on strict sharia law.
After the vote, in what many saw a symbol of compromise, Mongi Rahoui, a deputy from the assassinated leaders' party, embraced Habib Louz, an Ennahda hardliner. The two men sparred furiously over Islam last week.
"With this, Tunisia should be a model for the region," Ennahda chief Rached Ghannouchi said of the charter. "These advances in democracy in Tunisia should have a positive effect on the other Arab Spring countries."
Such compromise, though, looks difficult elsewhere.
Two years after Muammar Gaddafi was toppled, Libya's congress is deadlocked between Islamists and a nationalist party over the route for transition, a constitution is still undrafted, and former militia fighters run amok.
Egypt's own elected Islamist president, Mohamed Mursi, has been deposed by the army and jailed and his Muslim Brotherhood declared a terrorist organization.
Egyptians this month approved their new constitution as part of a transition plan from army chief General Abdel Fattah al-Sisi after he ousted Mursi in July.
Tunisia's Islamists were more willing to compromise. After months of protests and deadlock, Ennahda agreed late last year to step aside for a caretaker administration of nonpolitical appointments that would govern until elections.
Mehdi Jomaa, an engineer and former minister appointed as premier in December, on Sunday named his cabinet with key posts given to technocrats with international experience.
Hakim Ben Hammouda, an economist with experience at the African Development Bank, was named finance minister and Mongi Hamdi, a former U.N. official, foreign minister.
"The objective is to arrive at elections and create the security and economic climate to get out of this crisis," Jomaa told reporters.
No date has been set for elections but they will be held later this year with Ennahda and key opposition alliance Nidaa Tounes likely to battle for the government.
Jomaa's new cabinet will have to tackle demands from international lenders to cut public spending and curb the budget deficit without triggering protests over social welfare.
Islamist militants, tied to al Qaeda operations in North Africa, are also an increasing threat for a country that relies heavily on European tourism and overseas remittances for its hard currency income.
(Writing by Patrick Markey; Editing by Andrew Heavens, Marguerita Choy and Steve Orlofsky)