OBJECTIVES: To determine mental health outcomes for children with a history of child protection system involvement, accounting for pre-existing adversity, and to examine variation in risk across diagnostic groupings and child protection subgroups. DESIGN: A longitudinal, population-based record-linkage study. PARTICIPANTS: All children in Western Australia (WA) with birth records between 1990 and 2009. OUTCOME MEASURES: Mental health diagnoses, mental health contacts and any mental health event ascertained from International Classification of Diseases codes within WA's Hospital Morbidity Data Collection and Mental Health Information System from birth until 2013. RESULTS: Compared with children without child protection contact, children with substantiated maltreatment had higher prevalence of mental health events (37.4% vs 5.9%) and diagnoses (20% vs 3.6%). After adjusting for background risks, all maltreatment types were associated with an almost twofold to almost threefold increased hazard for mental health events. Multivariate analysis also showed mental health events were elevated across all child protection groups, ranging from HR: 3.54 (95% CI 3.28 to 3.82) for children who had entered care to HR: 2.31 (95% CI 2.18 to 2.46) for unsubstantiated allegations. Maternal mental health, aboriginality, young maternal age and living in socially disadvantaged neighbourhoods were all associated with an increased likelihood of mental health events. The increase varied across diagnostic categories, with particularly increased risk for personality disorder, and frequent comorbidity of mental health and substance abuse disorders. CONCLUSIONS: Young people who have been involved in the child protection system are at increased risk for mental health events and diagnoses. These findings emphasise the importance of services and supports to improve mental health outcomes in this vulnerable population. Adversities in childhood along with genetic or environmental vulnerabilities resulting from maternal mental health issues also contribute to young people's mental health outcomes, suggesting a role for broader social supports and early intervention services in addition to targeted mental health programmes.