A person with unsound mind can be released with pending investigation or trial under:-
High-Yield Explanation
Release of person of unsound mind pending investigation or trial (Sec. 330 CrPC): On the basis of medical opinion, whenever a person if found incapable of entering defense by reason of unsoundness of mind or mental retardation, the Magistrate may decide to order release of such person on bail or kept in such a place where regular psychiatric treatment can be provided. Sec. 84 IPC : Insane - not liable to be punished with unsoundness of mind at the time of doing.