  A new model of nonlinear electrodynamics with a dimensional parameter $\beta$
coupled to gravity is considered. We show that an accelerated expansion of the
universe takes place if the nonlinear electromagnetic field is the source of
the gravitational field. A pure magnetic universe is investigated and the
magnetic field drives the universe to accelerate. In this model, after the big
bang, the universe undergoes inflation, and the accelerated expansion and then
decelerates approaching Minkowski spacetime asymptotically. We demonstrate the
causality of the model and a classical stability at the deceleration phase.
