Genetic selection for milking speed is feasible. The existence of a correlation structure between milking speed and milk yield, however, necessitates a selection strategy to increase milking speed with no repercussion on genetic merit for milk yield. Residual milking duration (RMD) and residual milking duration including somatic cell score (RMDS), defined as the residuals from a regression model of milking duration on milk yield or milk yield plus somatic cell score (SCS) have been advocated. The objective of this study was to undertake a first ever genetic analysis of these novel traits. Data on electronically recorded milking duration and other milking characteristics from 235 005 test-day records on 74 608 cows in 1075 Irish dairy herds were available. Variance components for the milking characteristic traits were estimated using animal linear mixed models and covariances with other performance traits, including udder-related type traits, were estimated using sire models. The heritability of milking duration, RMD and RMDS was 0.20, 0.22 and 0.18, respectively. There were little differences in the heritability of RMD or RMDS when defined using genetic regression. The genetic standard deviation of RMDS defined on the phenotypic or genetic level was 36.8 s and 37.6 s, respectively, clearly indicating considerable exploitable genetic variation in milking duration independent of both milk yield and SCS. The genetic correlation between phenotypically derived RMDS and milk yield was favourable (-0.43), but RMDS was unfavourably genetically correlated with SCS (-0.30); the genetic correlations with both traits when RMDS was defined at a genetic level were zero. RMDS defined at the phenotypic level was negatively (i.e. unfavourable) genetically correlated (-0.35; s.e. = 0.15) with mastitis; however, when defined using genetic regression, shorter RMDS was not associated with greater expected incidence of mastitis. RMDS, defined at the genetic level, is a useful heritable trait with ample genetic variation for inclusion in a national breeding strategy without influencing genetic gain in either milk yield or udder health.