Sickness absence due to psychiatric problems is on the increase. Many sickness absentees do not recover and end up on a permanent disability pension (DP). A prospective cohort study of 12,283 women and 7099 men with a spell of sickness absence longer than 8 weeks, certified with a psychiatric diagnosis, was carried out. Diagnoses and socioeconomic data for each case were obtained from a national insurance research database. Socio-demographic data characterising each of Norway's 19 counties were obtained from Statistics Norway, and a deprivation index was constructed. Cox regression models with county-level variables only and combinations of variables at individual and county level were estimated separately for each gender as predictors of DP. Men had the highest risk of disability. Several individual-level variables predicted permanent disability. Contextual factors had a marginal effect among women also, after adjustment for individual-level variables. No such effect was present among the men.