The new document guarantees basic freedoms and gender equality.

After decades of dictatorship and two years of arguments and compromises, Tunisians have a new constitution laying the foundations for a new democracy.

The document is groundbreaking as one of the most progressive constitutions in the Arab world and for the fact that it got written at all. It passed late Sunday by 200 votes out of the 216 seats in the assembly of the Muslim Mediterranean country that inspired uprisings across the region after overthrowing a dictator in 2011.

“This constitution, without being perfect, is one of consensus,” assembly speaker Mustapha Ben Jaafar said after the vote. “We had today a new rendezvous with history to build a democracy founded on rights and equality.”

In a ceremony on Monday Ben Jaafar, Tunisian President Moncef Marzouki and outgoing Prime Minister Ali Larayedh signed the document in the assembly while deputies sang the national anthem.

In a statement, U.N. Secretary-General Ban Ki-moon said that “Tunisia can be a model to other people who are seeking reforms.”

The constitution enshrining freedom of religion and women’s rights took two years to finish. During that period, the country was battered by high unemployment, protests, terrorist attacks, political assassinations and politicians who seemed more interested in posturing than finishing the charter.

In Tunisia, an elected assembly of Tunisian Islamists, leftists and liberals worked on a detailed roadmap for their political future.

The new constitution sets out to make the North African country of 11 million people a democracy, with a civil state whose laws are not based on Islamic law, unlike many other Arab constitutions. An entire chapter of the document, some 28 articles, is dedicated to protecting citizens’ rights, including protection from torture, the right to due process, and freedom of worship. It guarantees equality between men and women before the law and the state commits itself to protecting women’s rights.

One of the most hotly debated articles guarantees “freedom of belief and conscience,” which would permit atheism and the practice of non-Abrahamic religions. It also bans incitement to violence and declaring a Muslim an apostate a fallen Muslim which leaves them open to death threats.

More In: World | International | News