We study the interplay between hysteresis and equilibrium behavior in capillary condensation of fluids in mesoporous disordered materials via a mean-field density functional theory of a disordered lattice-gas model. The approach reproduces all major features observed experimentally. We show that the simple van der Waals picture of metastability fails due to the appearance of a complex free-energy landscape with a large number of metastable states. In particular, hysteresis can occur both with and without an underlying equilibrium transition, and thermodynamic consistency is not satisfied along the hysteresis loop. © 2001 American Physical Society.