Fast radio bursts are bright, unresolved, non-repeating, broadband, millisecond flashes, found primarily at high Galactic latitudes, with dispersion measures much larger than expected for a Galactic source. The inferred all-sky burst rate is comparable to the core-collapse supernova rate out to redshift 0.5. If the observed dispersion measures are assumed to be dominated by the intergalactic medium, the sources are at cosmological distances with redshifts of 0.2 to 1 (refs 10 and 11). These parameters are consistent with a wide range of source models. One fast burst revealed circular polarization of the radio emission, but no linear polarization was detected, and hence no Faraday rotation measure could be determined. Here we report the examination of archival data revealing Faraday rotation in the fast radio burst FRB 110523. Its radio flux and dispersion measure are consistent with values from previously reported bursts and, accounting for a Galactic contribution to the dispersion and using a model of intergalactic electron density, we place the source at a maximum redshift of 0.5. The burst has a much higher rotation measure than expected for this line of sight through the Milky Way and the intergalactic medium, indicating magnetization in the vicinity of the source itself or within a host galaxy. The pulse was scattered by two distinct plasma screens during propagation, which requires either a dense nebula associated with the source or a location within the central region of its host galaxy. The detection in this instance of magnetization and scattering that are both local to the source favours models involving young stellar populations such as magnetars over models involving the mergers of older neutron stars, which are more likely to be located in low-density regions of the host galaxy.