Purpose: Psychiatric hospital length of stay (LOS) is not affected solely by socio-clinical factors but also by legal procedures. This study examined the associations between legal procedures and LOS.Methods: Data from 521 patients with psychiatric illnesses hospitalized over 2013-2015 were analyzed. Logistic regression was used to evaluate the predictors of longer (> 14 days) or prolonged (> 30) LOS with socio-clinical factors and legal procedures including court-ordered interventions (assisted outpatient treatment, medication over objection, and retention).Results: Longer LOS occurred in 246 patients and 99 had prolonged LOS. Legal procedures affected 57 patients, with 11 assisted outpatient treatments, 39 cases of medication over objection, and 16 retentions. Longer LOS was significantly associated with six factors including older age, unmarried status, non-Hispanic race, risk of violence, schizophrenia, and legal procedures. Legal procedures had the strongest association. Longer/prolonged LOS yielded qualitatively similar associations.Conclusion: Among 521 psychiatric inpatients, approximately 11% were mandated to receive interventions/procedures by the courts. Court-ordered legal procedures were strongly associated with longer LOS. Mental health providers may consider legal procedures for patients at high treatment/ medication noncompliance risk as early as patient admission to inpatient units to prevent, intervene or prepare for a longer or prolonged LOS.