  A small fraction of the population of intermediate-mass and massive stars
host strong and stable magnetic fields organised on large scales. These fields
are believed to be remnants of star formation. It is however not clear how such
fossil fields have been shaped during their formation and subsequent evolution.
We report recent and ongoing studies on the magnetic properties of pre-main
sequence stars and main sequence binaries, allowing us to make progress in this
field.
