  Magnetic fields surrounding spinning black holes can confine radiation and
trigger superradiant instabilities. To investigate this effect, we perform the
first fully-consistent linear analysis of the Ernst spacetime, an exact
solution of the Einstein--Maxwell equations describing a black hole immersed in
a uniform magnetic field $B$. In the limit in which the black-hole mass
vanishes, the background reduces to the marginally stable Melvin spacetime. The
presence of an event horizon introduces a small dissipative term, resulting in
a set of long-lived -- or unstable -- modes. We provide a simple interpretation
of the mode spectrum in terms of a small perfect absorber immersed in a
confining box of size $\sim1/B$ and show that rotation triggers a superradiant
instability. By studying scalar perturbations of a magnetized Kerr--Newman
black hole, we are able to confirm and quantify the details of this
instability. The instability time scale can be orders of magnitude shorter than
that associated to massive bosonic fields. The instability extracts angular
momentum from the event horizon, competing against accretion. This implies that
strong magnetic fields set an upper bound on the black-hole spin. Conversely,
observations of highly-spinning massive black holes impose an intrinsic limit
to the strength of the surrounding magnetic field. We discuss the astrophysical
implications of our results and the limitations of the Ernst spacetime to
describe realistic astrophysical configurations.
