We demonstrate that, for the baseline design of the CORE satellite mission, the polarized foregrounds can be controlled at the level required to allow the detection of the primordial cosmic microwave background (CMB) B-mode polarization with the desired accuracy at both reionization and recombination scales, for tensor-to-scalar ratio values of rgsim 5× 10−3. We consider detailed sky simulations based on state-of-the-art CMB observations that consist of CMB polarization with τ=0.055 and tensor-to-scalar values ranging from r=10−2 to 10−3, Galactic synchrotron, and thermal dust polarization with variable spectral indices over the sky, polarized anomalous microwave emission, polarized infrared and radio sources, and gravitational lensing effects. Using both parametric and blind approaches, we perform full component separation and likelihood analysis of the simulations, allowing us to quantify both uncertainties and biases on the reconstructed primordial B-modes. Under the assumption of perfect control of lensing effects, CORE would measure an unbiased estimate of r=(5 ± 0.4)× 10−3 after foreground cleaning. In the presence of both gravitational lensing effects and astrophysical foregrounds, the significance of the detection is lowered, with CORE achieving a 4σ-measurement of r=5× 10−3 after foreground cleaning and 60% delensing. For lower tensor-to-scalar ratios (r=10−3) the overall uncertainty on r is dominated by foreground residuals, not by the 40% residual of lensing cosmic variance. Moreover, the residual contribution of unprocessed polarized point-sources can be the dominant foreground contamination to primordial B-modes at this r level, even on relatively large angular scales, ℓ ~ 50. Finally, we report two sources of potential bias for the detection of the primordial B-modes by future CMB experiments: (i) the use of incorrect foreground models, e.g. a modelling error of Δβs = 0.02 on the synchrotron spectral indices may result in an excess in the recovered reionization peak corresponding to an effective Δ r > 10−3; (ii) the average of the foreground line-of-sight spectral indices by the combined effects of pixelization and beam convolution, which adds an effective curvature to the foreground spectral energy distribution and may cause spectral degeneracies with the CMB in the frequency range probed by the experiment.