The habeas corpus is the name of a legal action or writ by means of which detainees (Michael) can seek relief from unlawful imprisonment. The writ of habeas corpus has historically been an important instrument for the safeguarding of individual freedom against arbitrary state action (the decision by the Massachusetts Supreme Judicial Court).
A writ of habeas corpus ad subjiciendum is a court order addressed to a prison official (Lois Russo, Superintendent, SBCC) ordering that a prisoner be brought before the court so that the court can determine whether that person is serving a lawful sentence or should be released from custody. The prisoner, or some other person on his behalf (Kenneth Seiger, Appellate Lawyer), may petition the court or an individual judge for a writ of habeas corpus.