We investigate the quasistatic mechanical response of soils under cyclic loading using a discrete model of randomly generated convex polygons. This response exhibits a sequence of regimes, each one characterized by a linear accumulation of plastic deformation with the number of cycles. At the grain level, a quasiperiodic ratchetlike behavior is observed at the contacts, which excludes the exist...