Nepal's newly-elected Constituent Assembly has declared the former Himalayan kingdom a republic. The vote eventually ended 239 years of monarchy, but last minute political disputes delayed the decision and sparked clashes between republican supporters and riot police. Liam Cochrane reports from Kathmandu.

Nepal's king, revered by some as a living Hindu god, will have 15 days to leave the palace, after a special assembly abolished the monarchy. King Gyanendra will lose all royal privileges and his palace will be turned into a museum.

Thousands of people gathered in the streets to sing and dance in anticipation of the republic decision.

Krishna Pahadi is a human rights activist and republican.

"I mean, it's a dream come true, anyway, and it's an unprecedented day," said Krishna Pahadi. "It's a victory to the people of Nepal and we would like to thank everyone who has contributed. And especially we would like to pay homage to the martyrs, those who lost their lives to achieve this goal."

King Gyanendra took the throne after a massacre at the palace wiped out most of the royal family in 2001.

Gyanendra sacked the government in 2005 and seized control of the country, but was ousted the following year by massive street protests.

The abolition of the monarchy was a key aim of the former rebel Maoists, who spent a decade fighting a bloody insurgency but signed a peace deal two years ago and won the most votes in an election last month.

The election was for members of a Constituent Assembly, who will re-write Nepal's constitution.

But the assembly's first job was to declare Nepal a republic.

The crowds grew and security was tight, with more than 1,000 riot police surrounding the convention center where the assembly was meeting.

The long awaited meeting was delayed by 10 hours, as political leaders spent the day arguing over how much power should be vested in the president and prime minister.

The delays caused frustration among the thousands of Nepali citizens who had gathered outside the convention center to celebrate the announcement.

There was a brief clash between republican supporters and police with tear gas used to control the situation. And there were at least two small bombings but no serious injuries were reported.

It was almost midnight by the time the assembly finally voted and the republican motion passed with 560 in favor and just four votes against it.