Nepal's ousted Prime Minister Sher Bahadur Deuba has been freed from prison, a day after the anti-corruption body that convicted him was outlawed.
Mr Deuba says he will fight for democracy
Mr Deuba was jailed last July, having been sacked in February by King Gyanendra who seized direct power.
On Monday, the supreme court ordered the king's anti-graft body to be scrapped, calling its orders invalid.
"I am very happy to have been freed... My release is a democratic step," Mr Deuba told reporters on Tuesday.
"By this ruling, the court has established the concept of independence of the judiciary, existence of rule of law and recognised the sovereignty of the people."
An official from Mr Deuba's Nepali Congress Democratic Party, Dip Kumar Upadhaya, told the Associated Press that the former premier's release was "a victory for democracy and a humiliating defeat for the royal regime".
There has been no official reaction to Mr Deuba's release, but the government has said it would not contest Monday's supreme court ruling.
The BBC's Charles Haviland in Kathmandu says the ruling is another blow to King Gyanendra after local elections last week drew a turn-out of only 20%.
Our correspondent says the court order sets a possible precedent for legal challenges to other moves made by the king, including perhaps his takeover of power itself.
Mr Deuba, who has served three times as prime minister, arrived home in the early hours of Tuesday morning, his wife said. His nephew told Reuters he was in good health.
Mr Deuba was the highest-ranking of about a dozen officials to have been jailed by the controversial Royal Commission for Corruption Control.
Along with former minister Prakash Man Singh, he had been accused of embezzling millions of dollars intended for a water project in Kathmandu. Mr Singh and other officials jailed by the commission were also freed.
Mr Deuba always denied the charges and had refused to recognise the authority of the anti-corruption body. The Asian Development Bank, the main donor in the water project, itself ruled out corruption.
The king established the panel immediately after he seized control of the government and declared emergency rule in February 2005.
He accused the government of being corrupt and of failing to curb Nepal's Maoist insurgency.
Critics of the king say the panel acted as prosecutor, judge and jury.
The court agreed, declaring it unconstitutional and ordering it to be scrapped immediately.
An alliance of opposition parties has been organising street protests in Nepal to press the king to hand back power.
Maoist rebel leader Prachanda told the BBC, in a rare interview published on Monday, that the king must eventually face trial or go into exile.