...but Mars was still wet before. Okay, how? It looks like the gullies were formed by freeze-thaw cycles of carbon dioxide.
As they form, they reveal rocks that had water in them from earlier strata of Mars' surface.
Straightforward, right? Mars keeps proving to be a more complex world than we thought.