The Madras High Court on Tuesday granted conditional bail to former judge CS Karnan, who was arrested in December for allegedly making offensive remarks against a woman judge and the wives of Supreme Court judges, reported Bar and Bench.

Justice V Bharathidasan granted the bail directing Karnan to furnish two sureties of Rs 50,000 each. He has been told not to leave Chennai and to appear before the investigating officers when required, reported PTI.

There were 10 cases pending against the former judge under the Indian Penal Code and the Information Technology Act. Nine criminal cases were in connection with the 33 videos that Karnan had circulated abusing judges, their wives and other court staff, according to The Hindu. The tenth case was in connection with Karnan’s attempt to forcibly enter the house of retired Supreme Court judge Justice R Banumathi and verbally abuse her family members.

On Tuesday, the former judge also took an undertaking that he will not make any statement against judges, the institution, their family, staff, lawyers and others and also desist from making any complaints or publishing any posts on social media.

The High Court said that the bail will be cancelled if he fails to adhere to the conditions of his release.

At the hearing, Karnan told the High Court that he was suffering from severe mental depression when he had made the controversial remarks. His family members too had filed affidavits apologising for the former judge’s comments.

Senior Advocate G Rajagopalan, appearing for Karnan, told the High Court that the health condition of the former judge was deteriorating in jail and that he needed treatment.

Karnan had earlier applied for bail but it was rejected by the High Court on February 16.

Karnan was booked for his offensive remarks in October after a lawyer from the Madras High Court filed a complaint against him in connection with his remarks. In the same month, 10 lawyers from the Bar of Madras High Court had requested Chief Justice of India SA Bobde to intervene in the case and stop the circulation of one of the controversial videos. The lawyers had alleged that the video showed Karnan making a statement that “he had already threatened to sexually assault the wives of thirteen former and present Supreme Court judges and a retired woman judge of the Supreme Court”.

In May 2017, Justice Karnan became the first sitting High Court judge to be held guilty of criminal contempt of court. A constitution bench of the Supreme Court had sentenced him to six months imprisonment. After the announcement of the sentence, he went into hiding. He was arrested a month later and was sent to Presidency Jail in Kolkata, where he was imprisoned till December 2017.