Polyaniline (PANI)-coated iron-based nanocomposites with a range of magnetisation and coercivity values were produced by in situ polymerisation of aniline and chemical reduction of Fe3+ by BH4-. We have varied the ratio of aniline to iron, keeping the amount of BH4- added constant, and vice versa. Room-temperature magnetisation loops, X-ray diffraction patterns, Mossbauer spectra and transmission electron microscopy images show that PANI plays two distinct roles: on the one hand, it coats the iron particle surface, preventing oxidation of the Fe cores and, on the other, it enhances the formation of an Fe100-xBx alloy. The incorporation of boron in the alloy is facilitated by the polymer entrapment of small Fe nuclei. The mean particle size determined for composites obtained with low PANI content is (50 +/- 20) nm, while for PANI-rich composites (30 +/- 10) nm particles are formed.