In this paper, magnetic porous Ni-modified SiOC(H) ceramic nanocomposites (Ni/SiOC(H)) were successfully prepared via a template-free polymer-derived ceramic route, which involves pyrolysis at 600°C of nickel-modified allylhydridopolycarbosilane (AHPCS-Ni) precursors synthesized by the reaction of allylhydridopolycarbosilane (AHPCS) with nickel(II)acetylacetonate (Ni(acac)2). The resultant Ni/SiOC(H) nanocomposites are comprised of in-situ formed nanoscaled Ni socialized with small amounts of NiO and nickel silicides embedded in the amorphous SiOC(H) matrix. The materials show ferromagnetic behavior and excellent magnetic properties with the saturation magnetization in the range of 1.71–7.08emug−1. Besides, the Ni/SiOC(H) nanocomposites are predominantly mesoporous with a high BET surface area and pore volume in the range of 253–344 and 0.134–0.185cm3g−1, respectively. The measured porosity features cause an excellent adsorption capacity towards a template dye acid fuchsin with the adsorption capacity Qt at 10min of 80.7–85.8mgg−1 and the Qe at equilibrium of 123.8–129.8mgg−1.