  In the context of a U(1) gauge theory non-minimally coupled to scalar-tensor
gravity, we find a cosmological attractor solution that represents a de Sitter
universe with a homogeneous magnetic field. The solution fully takes into
account backreaction of the magnetic field to the geometry and the scalar
field. Such a solution is made possible by scaling-type global symmetry and
fine-tuning of two parameters of the theory. If the fine-tuning is relaxed then
the solution is deformed to an axisymmetric Bianchi type-I universe with
constant curvature invariants, a homogeneous magnetic field and a homogeneous
electric field. Implications to inflationary magnetogenesis are briefly
discussed.
