Context. Massive star formation remains one of the most challenging problems in astrophysics, as illustrated by the fundamental issues of the radiative pressure barrier and the initial fragmentation. The wide variety of physical processes involved, in particular the protostellar radiative feedback, increase the complexity of massive star formation in comparison with its low-mass counterpart. Aims. We aim to study the details of mass accretion and ejection in the vicinity of massive star forming cores using high-resolution (5 au) three-dimensional numerical simulations. We investigated the mechanisms at the origin of outflows (radiative force versus magnetic acceleration). We characterised the properties of the disc forming around massive protostars depending on the physics included: hydrodynamics, magnetic fields, and ambipolar diffusion. Methods. We used state-of-the-art three-dimensional adaptive-mesh-refinement models of massive dense core collapse, which integrate the equations of (resistive) grey radiation magnetohydrodynamics, and include sink particle evolution. For the first time, we include both protostellar radiative feedback via pre-main-sequence evolutionary tracks and magnetic ambipolar diffusion. To determine the role of magnetic fields and ambipolar diffusion play in the formation of outflows and discs, we studied three different cases: a purely hydrodynamical run, a magnetised simulation under the ideal approximation (perfect coupling), and a calculation with ambipolar diffusion (resistive case). In the most micro-physically complex model (resistive MHD), we also investigated the effect the initial amplitude of both magnetic field and solid body rotation have on the final properties of the massive protostellar system. We used simple criteria to identify the outflow and disc material and follow their evolution as the central star accretes mass up to 20 M⊙ in most of our models. The radiative, magnetic, and hydrodynamical properties of the outflows and discs are quantitatively measured and cross-compared between models. Results. Massive stars form in all our models, together with outflows and discs. The outflow is completely different when magnetic fields are introduced, so magneto-centrifugal processes are the main driver of the outflow up to stellar masses of 20 M⊙. Then, the disc properties heavily depend on the physics included. In particular, the disc formed in the ideal and resistive runs show opposite properties in terms of plasma beta; that is, the ratio of thermal-to-magnetic pressures and of magnetic field topology. While the disc in the ideal case is dominated by the magnetic pressure and the toroidal magnetic fields, the one formed in the resistive runs is dominated by the thermal pressure and essentially has a vertical magnetic field in the inner regions (R < 100−200 au). Conclusions. We find that magnetic processes dominate the early evolution of massive protostellar systems (M⋆ < 20 M⊙) and shapes the accretion and ejection as well as the disc formation. Ambipolar diffusion is mainly at work at disc scales and regulates its properties. We predict magnetic field’s topology within the disc and outflows, as well as disc masses and radii to be compared with observations. Lastly, our finding for the outflow and disc properties are reminiscent of the low-mass star formation framework, suggesting that accretion and ejection in young massive and low-mass protostars are regulated by the same physical processes in the early stages.