Features seen in portions of a typical midlatitude Martian impact crater show that gully formation follows a geologically recent period of midlatitude glaciation. Geological evidence indicates that, in the relatively recent past, sufficient snow and ice accumulated on the pole-facing crater wall to cause glacial flow and filling of the crater floor with debris-covered glaciers. As glaciation waned, debris-covered glaciers ceased flowing, accumulation zones lost ice, and newly exposed wall alcoves continued as the location for limited snow/frost deposition, entrapment, and preservation. Analysis of the insolation geometry of this pole-facing crater wall, and similar occurrences in other craters at these latitudes on Mars, shows that they are uniquely favored for accumulation of snow and ice, and a relatively more rapid exposure to warmer summer temperatures. We show that, after the last glaciation, melting of residual snow and ice in alcoves could have formed the fluvial channels and sedimentary fans of the gullies. Recent modeling shows that top-down melting can occur in these microenvironments under conditions similar to those currently observed on Mars, if small amounts of snow or frost accumulate in alcoves and channels. Accumulation and melting is even more favored in the somewhat wetter, relatively recent geological past of Mars, after the period of active glaciation.