image of homomorphism contains free group, then so does domain This question is a question which I had on my abstract algebra exam, I could not solve it:

True or false: suppose $f:G \to H$ is a group homomomorphism and assume that $\operatorname{Im}(f)$ contains a free group of rank $2$, then $G$ contains a free group of rank $2$.

I tried proving this statement, as I thought it is correct (at least intuitively this seems correct to me...). I did not manage, but still would like to find the answer. 
I attempted to prove this statement (actually, I tried proving a more general statement, as I thought there would not be much difference between rank $2$ or any rank at least $2$.)
This is my attempt: by the first isomorphism theorem, we have that 
$$F_n \leq \operatorname{Im}(f) \cong G/\ker f$$
and therefore, there is a subgroup $G_1$ of $G$ with $\ker f \leq G_1 \leq G$ and $F_n \cong G_1/\ker f$. In particular, $G_1/\ker f$ is finitely generated, with generating elements $g_1\ker f, \ldots, g_n \ker f$. 
At this point, I was stuck: I tried doing something with the $g_i$: I tried proving that $\langle g_1, \ldots, g_n \rangle$ was a free group of rank $n$, but this did not work out...
any hints on this question would be appreciated, as I still would like to know the answer (counterexamples
 A: Let $x,y$ in the image which generate a free group of rank $2$, write $f(a)=x, f(b)=y$. The subgroup $L$ generated by $a$ and $b$ is free. To see this, let $g$ be the restriction of $f$ to $L$, and $u\in Ker(g)$, you can write $u$ as a word in $a,b$, $u= a^{n_1}b^{m_1}...a^{n_l}b^{m_l}$, $g(u)=f(a)^{n_1}f(b)^{m_l}...f(a)^{n_l}f(b)^{m_l}=x^{n_1}y^{m_1}...x^{n_l}y^{m_l}=1$, since the group generated by $x,y$ is free, you deduce that ${n_i}={m_i}=0$. This implies that $u=1$ and $g$ is an isomorphism.
A: Your proof is most of the way there.
Let $F = \langle x_1, \dots, x_n\rangle$ be a copy of the free group of rank $n$, and write $H = \langle g_1, \dots, g_n\rangle$ for your unknown group. Then the map $x_i \mapsto g_i$ is a surjective group homomorphism $F\to H$.
What's its kernel? Well, whatever it is, it must be contained in the kernel of the composite map $F\to H\to G/\ker f$ sending each $x_i$ to $g_i\ker f$. But the kernel of this map is trivial, because the $g_i \ker f$ generate a free group by assumption. Hence the map $F\to H$ is an isomorphism.
