Nepal's rival political parties have reached agreement on a new constitution that will divide the country into eight provinces, ending years of deadlock, according to a minister.

The deal on Tuesday came weeks after an earthquake that killed thousands and devastated the country, adding to the pressure on politicians to end the stalemate.

Legislators have missed a series of deadlines to draft a new national charter following a decade-long Maoist rebellion that left an estimated 16,000 people dead and brought down the monarchy.

Minendra Rijal, the information minister, said the agreement was a "major breakthrough".

He said the natural disaster had "motivated us to work together", adding: "There is a will to get this done".

More than 8,700 people died in two quakes that hit Nepal on April 25 and May 12, destroying nearly half a million houses and leaving thousands without shelter.

The deal will see the creation of eight provinces, although it leaves the crucial issue of their borders unresolved.

The opposition Maoist party wants new provinces to be created along lines that could favour historically marginalised communities, but other parties say this would be divisive and a threat to national unity.

The agreement, which was concluded around midnight Monday, will be included in a draft charter that must be approved by a two-thirds parliamentary majority.

Dinanath Sharma, the Maoists' spokesperson, said the draft constitution would be ready in July.

Under the deal, Nepal will continue with its current system of governance, which includes an executive prime minister and ceremonial president.

A federal commission will be established and get six months to draw up internal borders and submit a proposal for approval in parliament.

An attempt by the governing parties earlier this year to present a draft of the constitution at the constituent assembly ended in a violent protest inside the assembly hall, where opposition members broke chairs and desks, and threw microphones and shoes at the speaker.

The protest spilled into street protests and a nationwide general strike.