Ferromagnetic or superparamagnetic nanocrystallites, stabilized in carbon matrix, were prepared by the procedure comprising formation of the appropriate metal acrylamide complex, followed by frontal polymerization and pyrolysis of the polymer. The pyrolysis products were in a form of beads, which contained in their volume randomly distributed nanocrystallites. The nanocrystallites had various composition, magnetic properties and sizes ranging from few to tens of nanometers, depending on the element type. Application of this procedure stabilizes the nanostructure and enables processing of nanoparticles within a narrow window of sizes. The magnetic parameters depend on the crystallite size, determined by their chemical composition. The nanocrystallites pyrolysed at 773 K exhibited ferromagnetic properties for Co and Fe, and superparamagnetic behaviour for the Ni. The nanocrystallites can potentially be applied as sensors for tagging the biological substances or for targeted drug delivery.