KATHMANDU, Nepal - The world's last Hindu kingdom became its newest secular republic Wednesday as Nepal's legislators, led by former communist insurgents, abolished the monarchy that had reigned over this Himalayan land for 239 years.
Throughout the day, thousands of people marched, danced and sang in the streets of Kathmandu in anticipation of the vote, waving red hammer-and-sickle flags as dour King Gyanendra awaited his fate in the pink concrete palace that dominates the city's centre.
He finally found out the fate of his throne late in the day when, as expected, the newly elected Constituent Assembly declared the country a republic and abolished the monarchy by a vote of 560-4. The assembly's 37 other members were not present.
"We have entered a new era today," said Prime Minister Girija Prasad Koirala, calling Nepal's rebirth as a republic "the dream of the whole nation."
There was no immediate reaction from the 61-year-old king, who has remained silent in recent months as it became apparent that his days on the throne were numbered.
He now has 15 days to leave the 1970s-era palace and move to his large private residence in the city, or face the possibility of being removed by force.
As word of the republic's declaration spread through Kathmandu, groups of celebrating young men yelled in the streets and set off firecrackers.
"The people in Nepal have defeated the autocrat Gyanendra," said Gopal Thapa, 23, a supporter of the Maoists, the former rebels. "Nepal is now the people's republic."
All around him, a crowd celebrating outside the convention centre, where the vote was held, chanted "Long live the republic!" and denounced Gyanendra as a thief.
Not since the Shah of Iran was deposed in the bloody 1979 Islamic revolution has one of the world's monarchs been forced from his throne.
But while the end of Nepal's royal dynasty may have come in a peaceful vote, the stage for the monarchy's demise was set by a communist insurgency that bled Nepal for a decade, and a 2001 palace massacre in which a gunman, allegedly the crown prince, assassinated King Birendra and much of the royal family before killing himself.
Gyanendra then assumed the throne. But the killings helped pierce the mystique surrounding a line of kings who had once been revered as reincarnations of the Hindu god Vishnu, and Gyanendra was dogged by rumours that he was somehow involved in the massacre.
His 2005 seizure of power from a civilian government only made matters worse. He said he needed total authority to crush the Maoists, but he quickly began locking up peaceful opponents and found himself beset by an intensifying insurgency and a faltering economy.
A year later, weeks of massive protests forced Gyanendra to restore democracy, after which the Maoists came out of the bush and began peace talks.
An interim government, meanwhile, slowly stripped away the trappings of a kingdom. Gyanendra lost command of the army, his portrait was replaced by Mount Everest on the currency, the word "royal" removed from the name of the national airline, and references to the king were dropped from the national anthem.
Gyanendra, who is believed to be personally wealthy with interests in tourism, tea and tobacco, also endured other indignities. His $3.1 million annual allowance was taken away, as were the queen's beauticians and about half his ceremonial guard.
Then came April's vote for the assembly in which the fiercely republican Maoists won the most seats, all but sealing the fate of the dynasty, which dates to 1769 when a regional ruler conquered Kathmandu and united Nepal.
With the king now gone, Nepalis are settling in for a three-day public holiday. But what comes next remains uncertain.
While the Maoists say they are committed capitalists and have no intention of nationalizing industries or setting up collective farms, they have promised to bring sweeping change to this largely impoverished country that in many place more closely resembles medieval Europe than a modern country.
But they are struggling to form a government. Wednesday's opening assembly session was delayed for hours as political parties wrangled over who should be president and what powers he should have. At the end of the day, they still did not have a deal.
Nepal also is still regularly bloodied by political violence, as evidenced by a string of small bombings that hit Kathmandu this week, including two on Wednesday.
None of the bombs - which appeared to have been aimed at pro-republic politicians and activists - caused any serious injuries. But they underscored how difficult it will be to fashion lasting peace in Nepal, where supporters of every major political party have been linked to killings since the start of the peace process.
And even in victory, the Maoists worry many in Nepal. They still have 20,000 fighters in UN-monitored camps spread across the country and their former fighters were recently implicated in the abduction and murder of a Kathmandu businessman.
In New York, UN Secretary General Ban Ki-moon congratulated Nepal's 27 million people on the assembly's first meeting and urged legislators "to form a new government as soon as possible," said UN deputy spokeswoman Marie Okabe.