  Fast radio bursts (FRBs) are highly dispersed millisecond-duration radio
bursts. Recent observations of a Galactic FRB suggest that at least some FRBs
originate from magnetars, but the origin of cosmological FRBs is still not
settled. Here we report the detection of 1863 bursts in 82 hr over 54 days from
the repeating source FRB~20201124A. These observations show irregular
short-time variation of the Faraday rotation measure (RM), which probes the
density-weighted line-of-sight magnetic field strength, of individual bursts
during the first 36 days, followed by a constant RM. We detected circular
polarisation in more than half of the burst sample, including one burst
reaching a high fractional circular polarisation of 75%. Oscillations in
fractional linear and circular polarisations as well as polarisation angle as a
function of wavelength were detected. All of these features provide evidence
for a complicated, dynamically evolving, magnetised immediate environment
within about an astronomical unit (au; Earth-Sun distance) of the source. Our
optical observations of its Milky-Way-sized, metal-rich host galaxy reveal a
barred spiral, with the FRB source residing in a low stellar density, interarm
region at an intermediate galactocentric distance. This environment is
inconsistent with a young magnetar engine formed during an extreme explosion of
a massive star that resulted in a long gamma-ray burst or superluminous
supernova.
