Mr Raja Petra runs a website frequently critical of the government
A prominent critic of the Malaysian government, blogger Raja Petra Kamaruddin, has been freed from jail on the orders of a judge.
Mr Raja Petra, 58, editor of the website Malaysia Today, has been held without trial for eight weeks under a draconian security law, the ISA.
He had been accused of causing ethnic tensions by ridiculing Islam.
"I'm really glad it's over," a tearful, haggard Mr Raja Petra said as he hugged his family and greeted supporters.
"I'm really tired. The judge's decision proves that there was no justification for my detention.
"We have to fight all-out and get the ISA abolished," he told reporters, referring to the Internal Security Act, which allows detention without charge for an initial two years, with indefinite extensions possible.
Mr Raja Petra was garlanded by supporters and then driven home in a maroon Rolls Royce which one of them had provided, said one report from the scene.
Mr Raja Petra was freed from a notorious prison camp in northern Malaysia on the orders of the high court in Shah Alam city near Kuala Lumpur.
It ruled that Interior Minister Syed Hamid Albar had overstepped his authority when he ordered the detention.
Mr Raja Petra has increasingly angered the Malaysian authorities with his critical Malaysia Today website, the country's best-known political blog.
He still faces charges of sedition for an article he published which linked Deputy Prime Minister Najib Razak to the 2006 murder of a Mongolian woman, Altantuya Shaariibuu.
Mr Najib, who has consistently denied any involvement, is widely expected to take over as prime minister when incumbent Abdullah Badawi agrees on a transition date.
Raja Petra's lawyer, Malik Imtiaz, described Friday's ruling as "historic", saying it was the first time a court had ordered the release of an ISA detainee since the government banned such rulings in 1989.
It was "definitely a wonderful step in terms of civil liberties in Malaysia", he said.
His words were echoed by Malaysia's human rights commissioner, Denison Jayasooria, who called it a "great day for human rights and fundamental liberties", according to AFP news agency.
He called for the ISA to be used only "where there is a real threat to national security".
Mr Raja Petra was arrested on 12 September under the ISA as part of a government clampdown on opposition voices.
He was arrested along with opposition deputy Teresa Kok and journalist Tan Hoon Cheng, both of whom have since been released.