There are five types of Writs which are Habeas Corpus, Mandamus, Certiorari, Quo Warranto and Prohibition and all these writs are an effective method of enforcing the rights of the people and to compel the authorities to fulfil the duties which are bound to perform under the law.
The Supreme Court or High Court can issue this writ against both private and public authorities.
Habeas Corpus can not be issued in the following cases:
When detention is lawful
When the proceeding is for contempt of a legislature or a court
Detention is by a competent court
Detention is outside the jurisdiction of the court