  A detailed stability analysis is presented for the de Sitter solution with a
homogeneous magnetic field that was recently found in the context of a $U(1)$
gauge theory nonminimally coupled to scalar-tensor gravity. The magnetic field
is `stealth' in the sense that the corresponding stress-energy tensor is of the
form of an effective cosmological constant and thus is isotropic despite the
fact that the magnetic field has a preferred spatial direction. We study the
stability of the solution against linear perturbations in the subhorizon and
superhorizon limits. We then present some explicit examples that satisfy all
stability conditions. The stable de Sitter solution with a homogeneous magnetic
field opens up a new possibility for inflationary magnetogenesis, in which
magnetic fields in the Universe at all scales may originate from a classical,
homogeneous magnetic field sustained during inflation.
