[1] We present a time-marching model which simulates the exchange of water ice between the Martian northern cap, the tropics, and a high-latitude surface reservoir. Net annual exchange rates of water and their sensitivity to variations in orbital/ rotational parameters are examined using the Martian water cycle modeled by the LMD three-dimensional Global Climate Model. These rates are propagated over the last 10 Myr to follow the thickness of the reservoirs. The effect of a sublimation dust lag is taken account to test simple models of layer formation. Periods of high mean polar summer insolation ( similar to 5 - 10 Ma ago) lead to a rapid exhaustion of a northern polar cap and a prolonged formation of tropical glaciers. The formation of a northern cap and of a high-latitude icy mantle may have started 4 Ma ago with the average decrease of polar insolation. Tropical ice may have disappeared around 2.7 Ma ago, but small glaciers could have formed during the last peaks of polar summer insolation. Over the last 4 Myr, most of the present cap may have formed at the expense of tropical and high-latitude reservoirs forming distinct layers at almost each similar to 51-kyr/120-kyr insolation cycle. Layers thickness ranges from 10 to 80 m, variations being produced by the modulation of the obliquity with similar to 2.4 and 1.3 Myr periods. Because only similar to 30 insolation cycles have occurred since 4 Ma ago, we found an inconsistency between the recent astronomical forcing, the observed number of layers, and simple astronomically based scenarios of layers formation.