A measurement is presented of inelastic photo- and electroproduction of J/ψ mesons in ep scattering at HERA. The data were recorded with the H1 detector in the period from 2004 to 2007. Single and double differential cross sections are determined and the helicity distributions of the J/ψ mesons are analysed. The results are compared to theoretical predictions in the colour singlet model and in the framework of non-relativistic QCD. Calculations in the colour singlet model using a k T factorisation ansatz are able to give a good description of the data, while colour singlet model calculations to next-to-leading order in collinear factorisation underestimate the data.