"Though the political ideology of a Maoist does not synchronise with constitutional polity, being a Maoist is not a crime," said Justice A Mushtaq.
"Freedom becomes unlawful when it confronts with laws of the country," he added.
The police cannot detain a person "merely because he is a Maoist" unless they find that their activities are unlawful, the judge said.
The court said Mr Balakrishnan should get Rs 1 lakh as compensation.
The son of a former high court judge, Mr Balakrishnan was detained in May last year for a few hours and then released.