"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.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.