Tunisia’s Islamic party Ennahda has agreed to join its main rival secular party Nidaa Tounes as part of a coalition government.

The deal reached on Sunday came after Tunisian Prime Minister-designate Habib Essid’s new cabinet faced a threat of rejection in parliament last week from key parties opposed to his choice of ministers.

Ennahda holds the second largest number of seats in parliament.

Tunisia has been praised for its recent run of free elections, new constitution and politics of compromise between secular and Islamic leaders four years after an uprising overthrew autocrat Zine El-Abidine Ben Ali.

Representatives from the leftist Popular Front have rejected Essid’s new cabinet partly because it contained former officials from Ben Ali’s regime, some of whom they said were suspected of corruption in the past.

Since its 2011 uprising, Tunisian politics has often been dominated by compromises between secular and Islamic leaders to keep democratisation on track after a series of deadlocks threatened to overturn its transition.

Nidaa Tounes won a parliamentary election in October and party leader Beji Caid Essebsi, a former Ben Ali official, also won the presidency in a second-round run off.

In the 217-seat parliament, Nidaa Tounes holds 86 seats and has some backing from the liberal, secular UPL party, which has 16 seats. But without the support of Ennahda, the party is left short of the 109 majority they need to ratify the cabinet.