Detaining of a person by lawful process or authority to assure his or her appearance to any hearing; the jailing or imprisonment of a person convicted of a crime.

Source: U.S. Courts

The care, control, and maintenance of a child which can be legally awarded by the court to an agency (in abuse and neglect cases) or to parents (in divorce, separation, or adoption proceedings). Child welfare departments retain legal custody and control of major decisions for a child in foster care; foster parents do not have legal custody of the children they care for.

Source: Children Welfare Information Gateway

(1) When someone is under the physical control of the court to make sure they go to court when theyre supposed to;

(2) when the court imprisons a person after they are found guilty of a crime;

(3) the care and control of children.

Source: California Courts.