Conditions for the existence and stability of de Sitter space in modified
gravity are derived by considering inhomogeneous perturbations in a
gauge-invariant formalism. The stability condition coincides with the
corresponding condition for stability with respect to homogeneous
perturbations, while this is not the case in scalar-tensor gravity. The
stability criterion is applied to various modified gravity models of the early
and the present universe.Comment: 22 pages, LaTeX, to appear in Phys. Rev.