An Indian court Tuesday ordered release of a Muslim doctor Kafeel Khan who was jailed under the country’s National Security Act for speaking against a controversial legislation.

Following the court order, he was released from a jail in Mathura in Uttar Pradesh on Tuesday midnight.

Last month, the government in the Uttar Pradesh state ruled by the Bharatiya Janata Party had extended Khan’s detention for another three months. On Tuesday, the state’s Allahabad High Court ordered his release, declaring the detention as “illegal”.

“The order of detention … passed by the district magistrate of Aligarh and confirmed by the State of Uttar Pradesh is set aside. The extension of the period of detention of Dr. Kafeel Khan is also declared illegal. A writ in the nature of habeas corpus is hereby issued to release Dr. Kafeel Khan, the detainee from State custody forthwith,” the court said in the judgment.

While the court said Khan was “certainly opposing the policies of the government and while doing so certain illustration are given by him”, it observed “that nowhere reflects the eventualities demanding detention.”

Kafeel Khan allegedly delivered a “provocative speech” at the Aligarh Muslim University last December during protests against a controversial Citizenship Amendment Act, which allows fast track Indian citizenship to non-Muslims from three neighboring countries.

The court said the Khan’s speech does not promote hatred or violence.

“A complete reading of the speech prima facie does not disclose any effort to promote hatred or violence. It also nowhere threatens peace and tranquillity of the city of Aligarh. The address gives a call for national integrity and unity among the citizens,” the court said.

Arrested on Jan. 29 from the Indian financial capital Mumbai, Khan was granted bail in February. But before he could be released, authorities extended his detention under the National Security Act. Under this law, a suspect can remain under custody without charge for up to 12 months.

Khan, a pediatrician at a hospital in Gorakhpur, Uttar Pradesh, made headlines when 63 children died in 2017 due to lack of oxygen. He was arrested for “medical negligence” and “corruption.” However, an inquiry cleared him of all charges.

Earlier this year, protests against the controversial citizenship law in northeast Delhi had turned violent. The communal violence initially began on Feb. 23 as a confrontation between groups supporting and opposed to the law. It quickly morphed into battles between Hindu and Muslim groups, which the police were unable to control. At least 53 people were reported dead.

Copyright 2022 Anadolu Agency. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.