Nepal's king will step down under an agreement reached between the country's major political parties to bring former communist rebels back into the government, party officials and the one-time insurgents said Monday.

The deal sets the stage for Nepal's transition to a full republic less than two years after the country's king was forced to cede his near-dictatorial powers following weeks of unrest.

King Gyanendra's reign has been filled with turmoil that began on his ascent to power in 2001 following the death of his brother, King Birendra, in a bizarre palace massacre apparently committed by Birendra's son. In all, 10 members of the royal family were killed.

The massacre gave the public a rare glimpse into the royalty of Nepal, a near-feudal wonderland for backpackers and mountain climbers drawn by Himalayan peaks such as Mount Everest.

Gyanendra inherited a nation traumatized by the murders, a squabbling political class and a countryside wracked by a violent communist insurgency. He dismissed Nepal's parliament in 2005 and seized total power.

But the insurgency worsened, the economy faltered and Gyanendra used heavy-handed tactics to silence the opposition, banning criticism of himself, his government and the army.

The result was weeks of unrest in April 2006 that ended with Gyanendra restoring parliament. He has since been stripped of his powers, command over the army and his immunity from prosecution.

But that wasn't enough for Maoists, who until Sunday had consistently pushed the elimination of the monarchy. While no timetable has been set for the communists to rejoin the government, the deal signed Sunday is seen as the beginning of Nepal's transition to a full republic.

The rebels have been trying since 1996 to overthrow the government and establish a socialist state. More than 10,500 people have died since the fighting began.

An agreement for them to rejoin the government was signed Sunday by leaders of the seven main political parties — including the Maoists — said Arjun Narsingh of the Nepali Congress, the Himalayan country's largest party.

On Monday, the former rebels were buoyant over the deal bringing them back into the fold. The deal stipulates the monarchy will be eliminated once a special assembly charged with rewriting the constitution is elected. The vote had been delayed indefinitely by the Maoists' withdrawal from the government, and officials now say they want to hold it in the first half the year.

"Now there is nothing else there needs to be done," Prachanda, the Maoist leader, who uses only one name, told reporters. "There is no monarchy left in the country."

The current monarch heads a dynasty that dates to 1769, when a regional ruler led an army down from the hills and conquered the ancient city of Katmandu. He established a line of kings that have been traditionally considered reincarnations of the Hindu god Vishnu, to be venerated by their subjects, over whom they once held near absolute sway.

But Gyanendra, the 12th Shah dynasty monarch, has never enjoyed the popularity of his predecessors and Sunday's deal to eliminate the throne was received largely with indifference in Katmandu.

"Before kings were part of people's heart," said Mata Pasad Risal, 60, a retired government official. "Now people have turned against him. The king has lost his position and popularity it will be best for him to leave the palace."

The king, who rarely makes public statements, did not comment on the agreement.

How soon the election can be organized now depends largely on how quickly the Maoists move to rejoin the government. One senior communist official, Chandra Prakash Gajurel, said Monday that they would decide at a party central committee meeting soon. But he gave no specific timeline.