By Patrick Markey and Tarek Amara
TUNIS (Reuters) - Tunisia offers perhaps the last hope for Arab Spring democracy; only in the small nation that inspired revolts from Cairo to Tripoli has the negotiating table won out over the gun, so far.
After months of crisis, Islamists and their secular opponents are bargaining over forming a caretaker government, a new constitution is a few penstrokes from completion and a second free election is around the corner.
Tunisia's stumbling way towards democracy is far from secure. A fragile political balance could yet be upset by infighting, economic malaise or the threat of violent militants determined to stamp their fundamentalist view onto the Arab World's most secular nation.
Still, Tunisia stands out in a troubled neighborhood where not much has gone right in the three years since Arab peoples began rising up against their autocratic leaders.
"We had five revolutions in the region and the others faced so many obstacles. Tunisia's is the last hope," Islamist party chief Rached Ghannouchi told Reuters. "We have conflict here, but we fight with words, with courts and laws, not bullets."
Elsewhere in North Africa, the military has removed Egypt's first freely-elected president and Libya is a mess of militia anarchy. Further afield, more than 100,000 people have died in Syria's civil war while Yemen is gripped by al Qaeda attacks and sectarian violence as it pursues reconciliation talks.
Tunisia's delicate consensus relies on two men: Ghannouchi, whose ruling Islamist party Ennahda is resigning as part of the effort to end the political crisis, and Beji Caid Essebsi, a former parliamentary speaker in the autocratic regime that once forced Ghannouchi into exile.
Egypt, where Islamist president Mohamed Mursi has gone on trial and hundreds have died in violence since his removal in July, has offered a sobering lesson.
"Tunisian leaders on both sides realize that violence benefits no one. They don't want to go down the path of Egypt," said one Western diplomat.
Tunisia began it all. In December 2010, a despairing vegetable seller set himself on fire, starting the Jasmine revolt that ousted autocrat Zine el-Abidine Ben Ali early the following year. Leaders of Egypt, Libya and Yemen also fell subsequently.
Much of the region has been plagued since by conflict among Islamists and secular factions, or old regimes and new rulers. But Tunisia, reliant on European tourism and remittances from overseas workers, has not slipped into widespread violence despite fierce debate over the role of Islam and mass rallies against Ennahda.
Unlike in Egypt, the Tunisian military has no history of political interference and has stayed out of the fray as party leaders fought over the shape of democracy.
Whereas Mursi's Muslim Brotherhood resisted pressure from the Egyptian army, Tunisia's Ennahda has proven more flexible.
Tunisians have also reconciled with old regime officials, allowing former members of Ben Ali's Constitutional Democratic Rally party back into politics. A proposed ban on "remnants", as old regime figures are known, has stalled. By contrast, the party of former Egyptian autocrat Hosni Mubarak has been dissolved.
Part of this may be expediency. Rather than the army, it was Tunisia's powerful nationwide UGTT labor movement that stepped in as broker to cajole the two sides to the table.
What has emerged in two messy years since Islamists won Tunisia's first free election, is an uneasy consensus between two main blocks - Ghannouchi's Ennahda and the secular alliance that has formed around Essebsi's Nidaa Tounes.
"Tunisia is at a crossroads between Essebsi and Ghannouchi," Nabil Karoui, owner of Nessma TV channel in an open letter printed in local newspapers. "It can be two possibilities: Two leaders of two rival tribes or two leaders for one country."
NO PAINLESS PATH
A positive outcome did not always seem so close. At the start of the year, militant gunmen shot dead left-wing opposition leader Chokri Belaid. Five months later another government critic, Mohamed Brahmi, was gunned down, pitching the country into crisis over Ennahda's rule.
The revival of ultraconservative Islamists once suppressed by Ben Ali had already inflamed debate over the role of Islam and the freedom of expression, cultural liberties and women's rights many feared were under threat.
The crisis quickly spread into protests as the opposition blamed Ennahda for being soft on radicals such as Ansar al-Sharia, a group linked to al Qaeda, allowing them to thrive.
But Ennahda had already shown its taste for compromise from the start after winning around 40 percent of parliamentary seats in the first election and sharing power with two secular smaller parties.
Ghannouchi, a white-haired Islamist scholar, has played a vital role in keeping hardliners in his party onboard, party officials and diplomats say. Likewise he has yielded to the opposition at major moments in the crisis.
"Ennahda can be a model for Islamists in the region if it accepts concessions more," said Boussairi Bou Abdeli of the Maghreb Republican Party. "The dialogue between Ghannouchi and Essebsi helps, but the key is in the hands of Ghannouchi."
After Belaid's assassination, Ennahda gave up important ministries to the opposition. It reined in hardliners demanding conservative amendments to the constitution, and eventually agreed to step down to make way for a caretaker administration.
Events in Egypt were decisive. Watching the bloodshed in Cairo, Ennahda officials say they learned from Mursi's errors and from their own mistakes in government.
"Maybe Tunisia is becoming a model for dealing with the difficulties of a democratic transition. In Egypt they failed," said Lotfi Zitoun, a senior Ennahda official. "Before Egypt, we thought the Arab Spring process was irreversible... In Egypt we saw it can be stopped."
THE NEXT STUMBLING BLOCK
Under Tunisia's political deal, the Ennahda's government will resign within weeks once negotiators have selected a new prime minister to lead a non-partisan caretaker cabinet which will run the country until elections.
The constituent assembly, suspended during the crisis, will go back to work to finish writing the constitution and an election committee will be selected to oversee the vote.
Talks stalled this month over who should be the new prime minister but party officials say the two sides are close to naming an independent acceptable to all. Former central bankers and finance ministers top the list.
The election date may be the next stumbling block with Ennahda pushing for a quick vote and the opposition wanting more time to organize. Mistrust between the parties remains raw, especially for those who see Ennahda clinging on to power.
"Even with the protests, with tens of thousands of people we never saw one glass broken," said Noureddine Ben Ticha, a Nidaa Tounes leader. "But the future of the country is very worrying. All the elements of a social explosion are there."
Economics may play a role in pressing a final compromise.
The International Monetary Fund and the World Bank - lenders to Tunisia's small economy - have warned of the cost of continued political stalemate. The African Development Bank has already cancelled a $300 million loan.
Turmoil in the region worries both sides of Tunisian politics. Libya's chaos is allowing Tunisian militants to train there and bring arms across the border. A suicide bombing at a Tunisian tourist beach, the first such attack in a decade, showed how vulnerable the country is.
This has raised concerns abroad that the stalemate is breeding instability. Officials from neighboring Algeria and the United States both met Ghannouchi and Essebsi this month to push for a final agreement on transition.
"For us, it is important to have the institutions working. Even if we fail in these elections, we can do some revisions and we have a chance to win the following one," Ghannouchi said. "But if we don't have elections at all, then it is a failure for everyone."
(editing by David Stamp)