What is the Writ of Habeas Corpus?

The writ of habeas corpus is a summons where whoever has custody of a prisoner will present the person before the Judge on the assigned court date. This also applies to mental patients needing treatments.