Lameness in dairy cows is a major animal welfare concern and has substantial economic impact through reduced production and fertility. Previous risk factor analyses have focused on housed systems, rather than those where cows were grazed for the majority of the year and housed only for the winter period. Therefore, the aim of this observational study was to identify a robust set of cow-level and herd-level risk factors for lameness in a pasture-based system, based on predictors from the housing and grazing periods. Ninety-nine farms were visited during the grazing period (April 2019-September 2019), and 85 farms were revisited during the housing period (October 2019-February 2020). At each visit, all lactating cows were scored for lameness (0 = good mobility, 1 = imperfect mobility, 2 = impaired mobility, 3 = severely impaired mobility), and potential herd-level risk factors were recorded through questionnaires and infrastructure measurements. Routine cow-level management data were also collected. Important risk factors for lameness were derived though triangulation of results from elastic net regression, and from logistic regression model selection using modified Bayesian information criterion. Both selection methods were implemented using bootstrapping. This novel approach has not previously been used in a cow-level or herd-level risk factor analysis in dairy cows, to the authors' knowledge. The binary outcome variable was lameness status, whereby cows with a lameness score of 0 or 1 were classed as non-lame and cows with a score of 2 or 3 were classed as lame. Cow-level risk factors for increased lameness prevalence were age and genetic predicted transmitting ability for lameness. Herd-level risk factors included farm and herd size, stones in paddock gateways, slats on cow tracks near the collecting yard, a sharper turn at the parlor exit, presence of digital dermatitis on the farm, and the farmers' perception of whether lameness was a problem on the farm. This large-scale study identified the most important associations between risk factors and lameness, based on the entire year (grazing and housing periods), providing a focus for future randomized clinical trials.