TUNISIA WAS the first Arab country to overthrow its autocracy in 2011, and for much of the past two years it has had the most success in building a new political order. Now the country faces the worst crisis since the revolution. On Tuesday, the prime minister of the Islamist-led government resigned after his own party refused to allow the appointment of a new, nonpartisan cabinet in response to the assassination of an opposition political leader. Though the streets of Tunis remain relatively calm, the risk is growing that uncompromising leaders will plunge the country into turmoil.

As in Egypt, where such turmoil is advancing, Tunisia’s population has become polarized between secular citizens, who fear that their liberties will be eroded by the new government, and the Islamists, who have been slow to seek accommodation with opponents or to control their most militant followers. The Ennahda party, which formed a coalition with a secular party following an October 2011 election, has a moderate platform, but it includes hard-line clerics in its ranks and is challenged by more militant Islamist groups outside of government. Secular parties, meanwhile, have fanned popular fears that the Islamists will ban alcohol, deprive women of their rights and drive away the Western tourists upon whom much of the economy depends.

It’s still not known who was responsible for the Feb. 6 assassination of Chokri Belaid, a prominent secularist and government critic whose slaying triggered the largest street demonstrations since the revolution. But Hamadi Jebali, a top leader of the Ennahda party, was right as prime minister to respond by denouncing the killing as “an act of terrorism against the whole of Tunisia.” Mr. Jebali pledged to set up a new government of technocratic ministers to serve until a constituent assembly completes a new constitution and new elections can be held.

Unfortunately, Mr. Jebali’s sensible course, which could have begun to bridge the dangerous secular-religious divide, was blocked by the Ennahda party, which refused to accept that its ministers would no longer manage key departments such as the interior ministry, which controls the police. Many Ennahda stalwarts appear to regard their first election victory as inviolable; they fail to understand that a successful democratic transition requires accommodating the reasonable demands of the minority.

Ennahda leaders are saying they still would like Mr. Jebali to form a new cabinet, though other, more hard-line leaders reportedly are also under consideration. The ex-prime minister, for his part, said in a speech to the country that he would do so only if a new government enjoyed broad support, the constitution were quickly completed and a firm date were set for elections. Those are the right conditions: Agreement on a constitution all sides can accept and a fair and free vote are the best way to defuse Tunisia’s polarization. Ennahda should listen to Mr. Jebali, before it is too late.