Many stars evolve into magnetic white dwarfs, and observations may help to understand when the magnetic field appears at the stellar surface, if and how it evolves during the cooling phase, and, above all, what are the mechanisms that generate it. After obtaining new spectropolarimetric observations and combining them with previous literature data, we have checked almost the entire population of about 152 white dwarfs within 20 pc from the Sun for the presence of magnetic fields, with a sensitivity that ranges from better than 1 kG for most of the stars of spectral class DA, to 1 MG for some of the featureless white dwarfs. We find that 33 white dwarfs of the local 20 pc volume are magnetic. Statistically, the data are consistent with the possibility that the frequency of the magnetic field occurrence is similar in stars of all spectral classes, except that in the local 20 pc volume, either DQ stars are more frequently magnetic, or host much stronger fields than average. The distribution of the observed field strength ranges from 40 kG to 300 MG and is uniform per decade, in striking contrast to the field frequency distribution resulting from spectroscopic surveys. Remarkably, no fields weaker than 40 kG are found. We confirm that magnetic fields are more frequent in white dwarfs with higher than average mass, especially in younger stars. We find a marked deficiency of magnetic white dwarfs younger than 0.5 Gyr, and we find that the frequency of the occurrence of the magnetic field is significantly higher in white dwarfs that have undergone the process of core crystallisation than in white dwarfs with fully liquid core. There is no obvious evidence of field strength decay with time. We discuss the implications of our findings in relation to some of the proposals that have been put forward to explain the origin and evolution of magnetic fields in degenerate stars, in particular those that predict the presence of a dynamo acting during the crystallisation phase.