  We present an analysis of errors on the tensor-to-scalar ratio due to
residual diffuse foregrounds. We use simulated observations of a CMB
polarization satellite, the Cosmic Origins Explorer, using the specifications
of the version proposed to ESA in 2010 (COrE). We construct a full pipeline
from microwave sky maps to $r$ likelihood, using two models of diffuse Galactic
foregrounds with different complexity, and assuming component separation with
varying degrees of accuracy. Our pipeline uses a linear mixture (Generalized
Least Squares) solution for component separation, and a hybrid approach for
power spectrum estimation, with a Quadratic Maximum Likelihood estimator at low
$\ell$s and a pseudo-$C_{\ell}$ deconvolution at high $\ell$s. In the
likelihood for $r$, we explore modelling foreground residuals as nuisance
parameters. Our analysis aims at measuring the bias introduced in $r$ by
mismodelling the foregrounds, and to determine what error is tolerable while
still successfully detecting $r$. We find that $r=0.01$ can be measured
successfully even for a complex sky model and in the presence of foreground
parameters error. However, the detection of $r=0.001$ is a lot more
challenging, as inaccurate modelling of the foreground spectral properties may
result in a biased measurement of $r$. Once biases are eliminated, the total
error on $r$ allows setting an upper limit rather than a detection, unless the
uncertainties on the foreground spectral indices are very small, i.e. equal or
better than 0.5\% error for both dust and synchrotron. This emphasizes the need
for pursuing research on component separation and foreground characterization
in view of next-generation CMB polarization experiments.
