KATMANDU, Nepal - The world's last Hindu monarchy is to be swept aside under an agreement between Nepal's former communist rebels and its major political parties that sets the stage for the country once idealized as a Himalayan Shangri-La to become a republic.
If it holds, the accord may finally bring a measure of peace and stability that has long eluded this impoverished, near-feudal wonderland for backpackers and mountain climbers.
At the center of much of Nepal's turmoil has been King Gyanendra, the often-dour, widely reviled head of a dynasty that for centuries held absolute sway over the country - a primacy he sought to reassert nearly two years ago, when he dismissed parliament and seized dictatorial powers.
The power grab was his undoing, and resulting weeks of unrest brought his enemies together, stoked the anger of an already wary public, and, as the deal signed Sunday makes clear, put Nepal on the road to becoming a republic.
"Now there is nothing else that needs to be done," Prachanda, the leader of the former communist rebels, who uses only one name, said yesterday. "There is no monarchy left in the country."
Gyanendra heads a dynasty that dates to 1769, when a regional ruler led an army down from the hills and conquered Katmandu. He established a line of kings that have been traditionally considered reincarnations of the Hindu god Vishnu, to be venerated by their subjects.
But Gyanendra, the 12th Shah dynasty monarch, has never enjoyed the popularity of his predecessors, and Sunday's deal to eliminate the throne was welcomed by many 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."
From the start, Nepalis were wary of Gyanendra, who before becoming king was known as a hardheaded businessman with interests in tourism, tea and tobacco.
His tumultuous reign began in 2001 after a palace massacre in which the crown prince is accused of gunning down Gyanendra's older brother, the late King Birendra, and much of the royal family and then killing himself.
In all, 10 members of the royal family were killed, and the slaughter helped pierce the mystique surrounding Nepal's royalty.
Four years later, Gyanendra dismissed parliament and seized total power, saying he would bring order to a chaotic political scene and quell the communist insurgency.
But the insurgency worsened, the economy faltered, and Gyanendra used heavy-handed tactics to silence opposition, jailing critics and banning criticism of himself, his government and the army.
As a result, the communists joined forces with Nepal's main parties to orchestrate weeks of unrest in April 2006 that ended with Gyanendra's restoring the parliament. He has since been stripped of his powers, of his command over the army, and of his immunity from prosecution.
That hasn't been enough for the communists, known as the Maoists. Last year, they ended their decade-long rebellion - a fight that killed about 13,000 people - and later joined the country's interim government.
But they withdrew in September, demanding that the monarchy be immediately abolished, a decision the other parties said could be made only after the election of the special assembly to rewrite the constitution.
The Maoists' move plunged Nepal into a political crisis, derailing plans to elect the assembly and threatening its transition to democracy.
Sunday's deal brings the Maoists back into the government by agreeing to eliminate the king once the assembly is elected, a vote that officials now say they hope to hold in the first half of 2008.
The king offered no immediate reaction to Sunday's accord.
Where would Gyanendra go? Money is said not to be a problem for him; he inherited much of his family's wealth after the 2001 massacre. And he has allies among the Hindu nationalists of India.
For now, Nepalis are simply eager to get rid of Gyanendra. They are not worrying about what comes next for a man they so clearly despise.
Said Navaraj Karki, a banker in Katmandu: "It would be better for him and the country if he just disappeared from the scene for good."