THREE YEARS after the first of the Arab revolutions, the hope that they would bring liberal democracy to the Arab Middle East has been all but extinguished — except in the country where they began. Tunisia, as with nearby Egypt and Libya, has been afflicted by political and economic dysfunction, terrorist violence and the polarization of secular and Islamic forces since ousting its dictator. But as the anniversary of its revolution approaches, the country’s political leaders have managed something that ought to be a new model for the region: democratic compromise.

Like Egypt’s Muslim Brotherhood, Tunisia’s Islamist Ennahda party won the first democratic elections after the revolution but quickly lost popularity because of poor governance, including its failure to control extremists. But rather than plunge into the battle to the death now underway between Egypt’s military regime and its secular allies and the Brotherhood, Tunisians struck a deal. On Thursday, Ennahda’s prime minister stepped down to make way for a technocratic administration that will govern until elections are held this year. Meanwhile, a national assembly has appointed a nonpartisan election commission and is rushing to complete a long-delayed constitution by early next week.

Both sides can claim a measure of victory. Ennahda avoided being driven from office by popular demonstrations or a military coup and achieved the government’s goal of completing a new constitution. Secular opposition parties can point to the liberal provisions of the new charter, which enshrines equality for women, democratic elections and freedom of speech and assembly. Both sides can hope for vindication in elections that look to be competitive and fair.

U.S. and European officials pressed Egypt’s generals and Islamists to reach such an accord before and after the July coup in Cairo but failed. That Tunisia succeeded, with considerably less Western engagement, in large part is because of Ennahda’s founder, Rachid Ghannouchi , who urged his movement to set aside most of its ideological agenda in favor of compromise. He found an interlocutor in Beji Caid Essebsi , a secular party leader and former prime minister who, unlike his counterparts in Egypt, did not court military intervention. Tunisia’s powerful labor unions also played a brokering role.

The country remains far from stable: Strikes and demonstrations continue in protest of government economic policy, and violent jihadists remain a serious threat. But Tunisia looks considerably more likely to achieve political stability and return to economic growth than does Egypt, where the conflict between secular and Islamist forces rages on. If Tunisia’s constitution is ratified and elections go forward, it will demonstrate that the dream of liberal democracy is not a mirage in the Arab world. On the contrary: Tunisia, which began the uprising against the old order, will establish the paradigm for a new one.