Nepal Prime Minister Madhav Kumar has agreed to resign. ((Gemunu Amarasinghe/Associated Press))

Nepal's prime minister agreed to resign after the former communist rebels supported his proposal to extend the term of parliament so it can draft a new constitution to end years of civil war and strife.

Prime Minister Madhav Kumar told reporters early Saturday he would resign soon, but did not elaborate.

Law Minister Prem Bahadur Singh said the three main political parties had agreed that the prime minister would resign within days, and a new national government would take power.

Maoists, the ex-rebels, have been protesting both in parliament and on the street for months demanding the prime minister's resignation.

The Maoists control most seats in the assembly, and their support was required to get the two-third majority to pass the government proposal.

The lawmakers approved the proposal just after midnight Friday. It was not decided who would succeed the prime minister, but the main political parties agreed to hold talks to form a national government that would include most political parties in the assembly.

The two-year term of the Constituent Assembly was set to end Saturday. The assembly intends to draft a new constitution to help guide Nepal out of years of civil war and upheaval, but has achieved little due to political bickering.

The Maoists ended their decade-old rebellion in 2006 and joined a peace process. Since then they have confined their fighters to UN-monitored camps and joined mainstream politics.

They won 2008 elections and formed a government, but it later fell in a dispute with the nation's president over the Maoists' attempt to replace the army chief.

The United Nations, which played a key role in the peace process, has expressed concern over the political situation in Nepal.

UN Secretary-General Ban Ki-moon called on "party leaders to regain their unity of purpose in order to preserve the assembly and the peace process."

"Now is the time to put national interest first," UN spokesman Martin Nesirky said Thursday at UN headquarters in New York