Tunisia's parliament has adopted a new constitution - the first since the ousting of President Zine el-Abidine Ben Ali three years ago.
The National Constituent Assembly passed the text by 200 votes from 216.
Analysts say politicians hope it will send out a message of stability after months of deadlock between Islamist and secular forces.
Meanwhile, Prime Minister-designate Mehdi Jomaa says he has formed a new caretaker government.
The cabinet consists mainly of independents and technocrats, and is expected to run the country until new elections. No date has been set for the polls.
After the vote on Sunday, the Tunisian flag was unfurled and parliamentarians embraced each other inside the chamber.
"This constitution, without being perfect, is one of consensus," AP quoted assembly speaker Mustapha Ben Jaafar as saying.
Parliament agreed the text on Friday after the governing Ennahda party granted a number of concessions, including dropping references to Islamic law.
It guarantees freedom of worship but says Islam is the state religion. It also forbids "attacks on the sacred", which analysts say is open to interpretation.
The text also recognises equality between men and women for the first time.
UN chief Ban Ki-moon hailed the agreement as a "historic milestone".
"Tunisia's example can be a model to other peoples seeking reforms," his spokesman said, reports the AFP news agency.
Tunis-based journalist Naveena Kottoor says large parts of the Tunisian public remain unconvinced that this constitution will actually make a difference to their lives, with many more concerned about the country's economic problems.
Ennahda, a moderate Islamist party, won the first democratic elections after long-time ruler Zine al-Abidine Ben Ali was forced from power in 2011.
But it has faced fierce opposition from secular groups, who have accused it being too close to militant groups - charges it strongly denies.
It has also been unable to end an economic crisis, another factor in widespread street protests.
The constitution required two-thirds of assembly members to vote in favour. A signing ceremony is expected to follow.
The killing of two secular politicians last year sparked a political crisis in Tunisia.
Earlier this month, Ennahda Prime Minister Ali Larayedh stepped down and was replaced by Mehdi Jomaa, who will head a non-partisan, caretaker government, which is expected to be named in the coming days.