Integrability and the variational formulation of non-conservative mechanical systems