Anisotropic cosmological models with nonminimally coupled magnetic field