TUNISIANS have suffered plenty of disappointment since their joyous toppling of a nasty dictator three years ago. But unlike elsewhere in the Arab world their mood was again mostly buoyant as they marked the anniversary of Zine el-Abidine Ben Ali’s fall on January 14th. The sole quibble was that the country’s elected constituent assembly had not quite finished its line-by-line ratification of a new constitution in time for the celebration.

Considering the often tumultuous course of Tunisia’s transition, the near-certain passage of the constitution is a momentous achievement. The draft was supposed to have been finished more than a year ago. But disputes between Islamists and secularists, worsened by economic stagnation, social unrest and sporadic violence that included a pair of assassinations last year, sent things askew. The assembly suspended deliberations for five months last summer, returning to the job only after the Islamists’ Nahda party, Tunisia’s strongest, agreed to relinquish control of government to a non-partisan cabinet.

To the surprise of secular-minded sceptics, Nahda has kept its word. On January 9th the prime minister, Ali Laarayedh, a Nahda man, made way for an incoming team. Nahda’s voluntary exit will let it go into the next polls claiming to have put the country’s stability ahead of narrow party interests. Perhaps more surprisingly, the Islamists have also graciously conceded numerous sticky points in the constitution. The result is a document that has been widely praised as fair and progressive.

Unlike the case in Egypt, where voters this week have almost certainly been endorsing a hastily drafted constitution that enshrines Islamic law, restricts religious freedom to “revealed faiths” and grants unusual privileges to the army and police, Tunisians will enjoy full freedom of conscience. The collaborative spirit in their assembly was such that after approving a clause that guarantees absolute equality between the sexes, including eventual parity between men and women in elected bodies, the whole chamber burst into a spontaneous chant of Tunisia’s national anthem.

The incoming prime minister, Mehdi Jomaa, a 51-year-old engineer, still faces a host of tricky negotiations to form an acceptably neutral cabinet. This will rule until general elections later this year for a full-blown parliament to replace the current assembly.

To keep the process towards democracy on track, Mr Jomaa needs to work to improve Tunisians’ quality of life. Sporadic riots across the country in recent weeks have shown how unrest is triggered by local gripes—from tensions with customs officials in a village where contraband is a mainstay to a protest against a rise in vehicle tax. Many, especially outside the capital, feel that their demands for better infrastructure and health services have not been heard. Unemployment remains stubbornly high. Food prices are rising.

Yet Tunisia’s ability to compromise between those who espouse Islamist principles in government and those who want to keep religion out of public affairs has given it the edge over other Arab states in transition. The relative homogeneity of this country of 10.6m helps. Education levels are higher than in Egypt. The army prefers to keep out of both politics and business, while career civil servants have developed a professional ethos. A feisty civil-liberties lobby finds a willing ear in the media at home and abroad. This has obliged Nahda to face down conservatives within its party, as well as more radical Islamists outside it. If hopes for the Arab spring have faded elsewhere, in Tunisia they are again looking bright.