This research aimed to investigate factors associated with vitamin D deficiency and to provide data about its prevalence in patients suffering from different psychiatric illnesses. The study had a cross-sectional design and it included 220 patients of both genders, aged from 19-81 y, with a wide range of mental disorders (F00 F89), and treated in routine ambulatory and hospital practice. The researchers collected data from three sources: medical records, a study questionnaire and biochemical analysis of patients' serum samples (concentration of vitamin D measured as 25(OH)D, calcium, phosphorus, magnesium, sodium and potassium). Data were analyzed using descriptive statistics, methods for hypothesis testing and binary logistic regression, at the p <= 0.05 level. A total of 140 patients (64%) had a deficiency of vitamin D (20 ng/mL). Among variables related to demographics, life style habits, mental illness, comorbid disorders and drugs, two of them, female gender (odds ratio (OR)=2.5, 95% confidence interval (CI)=1.3-4.9, p=0.006) and using clozapine (OR =-15.6, 95% CI 1.7-144.7, p=0.02), were significantly associated with vitamin D deficiency. Physical activity (OR= 0.4, 95% CI 0.2-0.9, p=0.02), exercising (OR= 0.2, 95% CI <0.1-0.7, p=0.02) and offal in the diet (OR=0.5, 95% CI 0.3-0.9, p=0.03) significantly aggregated in the patients who had a 25(OH)D serum concentration above the deficiency cut-off level. Patients with mental disorders are at high risk for vitamin D deficiency, particularly females and clozapine users as well as those having no adequate physical activity or dietary habits.