Aims/hypothesis Type 2 diabetes mellitus has been associated with brain atrophy and cognitive decline, but the association with ischaemic white matter lesions is unclear. Previous neuroimaging studies have mainly used semiquantitative rating scales to measure atrophy and white matter lesions (WMLs). In this study we used an automated segmentation technique to investigate the association of type 2 diabetes, several diabetes-related risk factors and cognition with cerebral tissue and WML volumes. Subjects and methods Magnetic resonance images of 99 patients with type 2 diabetes and 46 control participants from a population-based sample were segmented using a k-nearest neighbour classifier trained on ten manually segmented data sets. White matter, grey matter, lateral ventricles, cerebrospinal fluid not including lateral ventricles, and WML volumes were assessed. Analyses were adjusted for age, sex, level of education and intracranial volume. Results Type 2 diabetes was associated with a smaller volume of grey matter (−21.8 ml; 95% CI −34.2, −9.4) and with larger lateral ventricle volume (7.1 ml; 95% CI 2.3, 12.0) and with larger white matter lesion volume (56.5%; 95% CI 4.0, 135.8), whereas white matter volume was not affected. In separate analyses for men and women, the effects of diabetes were only significant in women. Conclusions/interpretation The combination of atrophy with larger WML volume indicates that type 2 diabetes is associated with mixed pathology in the brain. The observed sex differences were unexpected and need to be addressed in further studies. Electronic supplementary material The online version of this article (doi:10.1007/s00125-007-0688-y) contains a list of members of the Utrecht Diabetic Encephalopathy Study Group, and is available to authorised users.