Nepal is set to adopt its first full democratic charter on Sunday, a historic step for a nation that has seen war, a palace massacre and devastating earthquakes since it began a campaign to create a modern state more than 65 years ago.
President Ram Baran Yadav will formally promulgate the constitution intended to unite the country but it has already exacerbated divisions in some places with 40 people killed in protests against it in recent weeks.
Nepal's powerful neighbours, India and China, are keen to see stability and to limit each other's influence in the poor Himalayan country sandwiched between them.
"The constitution that will be promulgated is the outcome of many years of struggle by the Nepali people," Prateek Pradhan, media adviser to the prime minister, told Reuters.
"It addresses the aspirations and demands of all sections of Nepali society in an inclusive and representative manner. Prime Minister Sushil Koirala is extremely happy to have reached this moment."
The earthquakes that killed more than 9,000 people this year galvanized politicians, who had squabbled for seven years to finish the charter.
It creates seven states in a secular, federal system, but is opposed by some groups who wanted to re-establish Nepal as a Hindu nation, and others who feel it is unfavourable to people in the plains, near India.
Demonstrations in the lowlands in recent weeks were met with a tough response from Kathmandu, which ordered in the army after protesters attacked and killed police. More than 40 protesters and police died.
The unrest troubles India, which has called for dialogue.
China welcomed the new constitution saying that as a "friendly neighbour" it hoped for increased stability and growth.
The government says an imperfect document is better than nothing, and the constitution can be amended to reflect the aspirations of dissenting groups.
Nepal's 239-year old monarchy was abolished in 2008, seven years after an unhinged crown prince killed the king and eight members of his family at the height of a Maoist uprising.
Disgruntled royalist politicians voted against the charter on Wednesday, while some parties from the southern lowlands abstained.
The Maoists laid down their arms in 2006 and joined democratic politics with an India-brokered peace deal that paved the way for the constitution. Wrangling hampered progress on the draft and several governments have come and gone in the interim.
Koirala is expected to stand down to allow a new government under the charter. He may be replaced by KP Oli, from a moderate Communist party.
Clauses over citizenship in the country of 28 million people were some of the most contentious with critics saying they discriminate against women who marry foreigners, and that their children are denied equal access to citizenship.
Estimates of the number of stateless people in Nepal range from 800,000 to 4 million.