Solution (source code)

= Solution

For every open normal subgroup $U\triangleleft G$, the composite
$$
\Gamma\xrightarrow{f}G\longrightarrow G/U
$$
has finite image and therefore factors uniquely through the <profinite completion> $\widehat\Gamma$. These factor maps are compatible as $U$ varies. The <universal property of an inverse limit> consequently produces a continuous homomorphism
$$
\widehat f:\widehat\Gamma\longrightarrow
\varprojlim_U G/U\cong G
$$
with $\widehat f\iota=f$. It is unique because $\iota(\Gamma)$ is dense in $\widehat\Gamma$ and two continuous maps into the Hausdorff group $G$ that agree on a dense subset agree everywhere. This is the <universal property of profinite completion>.