The Madhya Pradesh High Court on Thursday ordered immediate release of religious leader Computer Baba, arrested earlier this month after his "illegal" ashram in Indore district was demolished.
Subsequently, he was released from a prison in Indore in the evening.
A division bench of Justices SC Sharma and Shailendra Shukla directed that Namdeo Das Tyagi (54), popularly known as Computer Baba, should be released forthwith if he was not wanted in any other case.
The court was hearing a habeas corpus petition, his lawyer said.
Habeas corpus petition is generally filed when a person is missing or has been illegally detained.
The order should be immediately forwarded to the jail authorities, and Additional Advocate General Pushyamitra Bhargava "shall also undertake to communicate the order...to the Superintendent of Central Jail, today itself," the HC said.
Mr Bhargava told the court that Baba was arrested under relevant section of the Code of Criminal Procedure, and an order for his release has already been issued.
Baba was arrested on November 8 by way of preventive action after the illegal construction he had made on two acres of government land on the city's outskirts was demolished.
Three cases were registered against him at two police stations in Indore after the arrest.
His lawyer Vibhor Khandelwal said the lower courts had granted his client bailing all three cases.
Computer Baba was appointed chairman of a river conservation trust by the previous Kamal Nath-led Congress government and enjoyed the status of Minister of State. Before that, the BJP government too had given him MoS rank.
He later fell out with the BJP. In the run-up to November 3 by-elections to 28 Assembly seats in the state, he had dubbed 22 rebel Congress MLAs who joined the BJP as "traitors".