Background Cannabis use is associated with an earlier age at onset of psychotic illness. The aim of the present study was to examine whether this association is confounded by gender or other substance use in a large cohort of patients with a non-affective psychotic disorder. Method In 785 patients with a non-affective psychotic disorder, regression analysis was used to investigate the independent effects of gender, cannabis use and other drug use on age at onset of first psychosis. Results Age at onset was 1.8 years earlier in cannabis users compared to non-users, controlling for gender and other possible confounders. Use of other drugs did not have an additional effect on age at onset when cannabis use was taken into account. In 63.5% of cannabis-using patients, age at most intense cannabis use preceded the age at onset of first psychosis. In males, the mean age at onset was 1.3 years lower than in females, controlling for cannabis use and other confounders. Conclusions Cannabis use and gender are independently associated with an earlier onset of psychotic illness. Our findings also suggest that cannabis use may precipitate psychosis. More research is needed to clarify the neurobiological factors that make people vulnerable to this precipitating effect of cannabis. © 2012 Cambridge University Press.