  We have performed smoothed particle radiation magnetohydrodynamics (SPRMHD)
simulations of the collapse of rotating, magnetised molecular cloud cores to
form protostars. The calculations follow the formation and evolution of the
first hydrostatic core, the collapse to form a stellar core, the launching of
outflows from both the first hydrostatic core and stellar cores, and the
breakout of the stellar outflow from the remnant of the first core. We
investigate the roles of magnetic fields and thermal feedback on the outflow
launching process, finding that both magnetic and thermal forces contribute to
the launching of the stellar outflow. We also follow the stellar cores until
they grow to masses of up to 20 Jupiter-masses, and determine their properties.
We find that at this early stage, before fusion begins, the stellar cores have
radii of $\approx 3$ R$_\odot$ with radial entropy profiles that increase
outward (i.e. are convectively stable) and minimum entropies per baryon of
$s/k_{\rm B} \approx 14$ in their interiors. The structure of the stellar cores
is found to be insensitive to variations in the initial magnetic field
strength. With reasonably strong initial magnetic fields, accretion on to the
stellar cores occurs through inspiralling magnetised pseudo-discs with
negligible radiative losses, as opposed to first cores which effectively
radiate away the energy liberated in the accretion shocks at their surfaces. We
find that magnetic field strengths of >10 kG can be implanted in stellar cores
at birth.
