Lameness in dairy herds is traditionally detected by visual inspection, which is time-consuming and subjective. Compared with healthy cows, lame cows often spend longer time lying down, walk less and change behaviour around feeding time. Accelerometers measuring cow leg activity may assist farmers in detecting lame cows. On four commercial farms, accelerometer data were derived from hind leg-mounted accelerometers on 348 Holstein cows, 53 of them during two lactations. The cows were milked twice daily and had no access to pasture. During a lactation, locomotion score (LS) was assessed on average 2.4 times (s.d. 1.3). Based on daily lying duration, standing duration, walking duration, total number of steps, step frequency, motion index (MI, i.e. total acceleration) for lying, standing and walking, eight accelerometer means and their corresponding coefficient of variation (CV) were calculated for each week immediately before an LS. A principal component analysis was performed to evaluate the relationship between the variables. The effects of LS and farm on the principal components (PC) and on the variables were analysed in a mixed model. The first four PC accounted for 27%, 18%, 12% and 10% of the total variation, respectively. PC1 corresponded to Activity variability due to heavy loading by five CV variables related to standing and walking. PC2 corresponded to Activity level due to heavy loading by MI walking, MI standing and walking duration. PC3 corresponded to Recumbency due to heavy loading by four variables related to lying. PC4 corresponded mainly to Stepping due to heavy loading by step frequency. Activity variability at LS4 was significantly higher than at the lower LS levels. Activity level was significantly higher at LS1 than at LS2, which was significantly higher than at LS4. Recumbency was unaffected by LS. Stepping at LS1 and LS2 was significantly higher than at LS3 and LS4. Activity level was significantly lower on farm 3 compared with farms 1 and 2. Stepping was significantly lower on farms 1 and 3 compared with farms 2 and 4. MI standing indicated increased restlessness while standing when cows increased from LS3 to LS4. Lying duration was only increased in lame cows. In conclusion, Activity level differed already between LS1 and LS2, thus detecting early signs of lameness, particularly through contributions from walking duration and MI walking. Lameness detection models including walking duration, MI walking and MI standing seem worthy of further investigation.