|Thousands took to the streets in recent weeks to protest the slow pace of progress since the 2008 election [AFP]
Nepal's main political parties have agreed to extend parliament's term for three months, leaders said, in an eleventh-hour deal that will see the prime minister step down.
The agreement on sunday followed days of tense negotiations over the future of Nepal's parliament, or Constituent Assembly (CA), elected in 2008 on a two-year mandate to write a new constitution for the young republic.
Despite being granted an extra 12 months last year, it has been unable to complete the task, amid fierce disagreements between the main political parties.
Its term was due to expire on Saturday, plunging the country into legal limbo. But Bhim Rawal, a senior leader of the ruling UML (Unified Marxist-Leninist) party, said opposition legislators had agreed to give it three more months.
He said the deal would see Prime Minister Jhalanath Khanal step down at an unspecified time in the future to pave the way for a new power-sharing government.
The parties have also committed to produce a draft constitution in that time, he said.
Parliament will vote on the extension later on Sunday but with the support of all three major parties - including the main opposition Nepali Congress - it is certain to pass.
Earlier, thousands of people gathered outside Nepal's parliament to press legislators to prolong the life of the assembly and complete the task they were elected to perform.
"There is no alternative but to extend parliament's term," said 48-year-old shop owner Jitman Thapa outside the CA building, where thousands of riot police were deployed.
"So many people have gathered here to voice their concern. But the leaders must deliver the constitution within the extended term."
The widespread hope that followed the end of a decade-long civil war in 2006 and the abolition of the monarchy two years later have been replaced by a growing sense of anger and frustration in Nepal, one of the world's poorest countries.
Nepal was without a government for seven months before the current prime minister was elected in February. Such a situation has stifled economic growth, forcing many Nepalese to seek work overseas.
Thousands have taken to the streets in recent weeks in protest at the slow pace of progress since the 2008 elections and politicians' failure to complete the constitution.
Police said 12 people had been arrested on Saturday for protesting outside the CA building, where barricades were erected to keep demonstrators away from the negotiations.
"The situation is volatile and we want to make sure that none of the groups take advantage," police spokesman Nawaraj Dhakal told AFP.
International pressure to find a resolution to the crisis has also grown in recent days.
UN chief Ban Ki-moon on Monday expressed concern about the situation in Nepal, urging the parties to "show leadership and carry out the necessary compromises to preserve the peace process".
The coalition government, which includes the leftist UML and Maoist parties, initially proposed a one-year extension, but was unable to secure enough votes to push that through parliament.