  We introduce the quasi-topological electromagnetism which is defined to be
the squared norm of the topological 4-form $F\wedge F$. A salient property is
that its energy-momentum tensor is of the isotropic perfect fluid with the
pressure being precisely the opposite to its energy density. It can thus
provide a model for dark energy. We study its application in both black hole
physics and cosmology. The quasi-topological term has no effect on the purely
electric or magnetic Reissner-Nordstr\"om black holes, the dyonic solution is
however completely modified. We find that the dyonic black holes can have four
real horizons. For suitable parameters, the black hole can admit as many as
three photon spheres, with one being stable. Another intriguing property is
that although the quasi-topological term breaks the electromagnetic duality,
the symmetry emerges in the on-shell action in the Wheeler-DeWitt patch. In
cosmology, we demonstrate that the quasi-topological term alone is equivalent
to a cosmological constant, but the model provides a mechanism for the dark
energy to couple with other types of matter. We present a concrete example of
the quasi-topological electromagnetism coupled to a scalar field that admits
the standard FLRW cosmological solutions.
