Nepal's main political party leaders have agreed to extend the country's parliamentary term by one year, following talks aimed at averting a political crisis.
The leaders struck the deal just after midnight on Friday minutes after the assembly's term was due to expire, senior government officials said.
"We have agreed to extend the tenure of the Constitutional Assembly (parliament)," the AFP news agency quoted Arjun Narsingh KC, a Nepali congress spokesman, as saying.
"The Constitutional Assembly will now carry out the necessary procedures."
Al Jazeera's Hamish MacDonald, reporting from the capital, Kathmandu, said the move will give the parties more time to write a constitution, which was also due to expire on Friday, leaving the country in political limbo.
"That will give them an extra 12 full months to write a constitution," he said.
The government had said that the term of the parliament, which was elected in 2008, should be extended by one year.
However, the former rebel Maoists, who hold the greatest number of seats in parliament, had demanded that the government resign and allow them to lead a new coalition administration in return for the extension.
Our correspondent said the Maoist demand was likely to happen.
"We understand that a national unity government will be formed. It's likely that the Maoists will have a big part to play in that because they are the largest single party in the parliament," he said.
"Once that is sorted out, we understand [Madev Kumar Nepal] the prime minister from the Nepali congress will agree to step down.
"So some very significant developments at the very last possible moment, because it was not just the assembly that expired after that deadline, but all laws governing this country."
The Nepali Congress and the Communist Party of Nepal (UML), the other main political parties, had pushed for varied concessions from the Maoists in order to come to an agreement.
The UN urged for all sides on Thursday to come to an agreement in the interests of the peace process established in 2006 after a decade-long civil war.
"The constituent assembly and its progress to date toward the adoption of Nepal's new constitution represent a significant and hard-won achievement of the peace process," a UN statement said.
Ban Ki-moon, the UN secretary-general, appealed in the statement to the party leaders "to regain their unity of purpose in order to preserve the assembly and the peace".
He said now is the time "to put national interest first".
After changing from a monarchy to a republic in 2007, the Maoists won parliamentary elections in 2008. However, their rule lasted only nine months and they were left out of the succeeding coalition.
The current CA has failed to agree on the wording of a new constitution.