Does maps between fundamental groups induces a continuous map between spaces?

Main question is this: Suppos $$M$$ is a manifold and $$G$$ is a finite group. If there is a group homomorphism $$\phi:\pi_1 M\to G$$, is there a continuous map $$f:M\to BG$$, where $$BG$$ is a classifying space?

One may generalize this question to ask if the functor $$\pi_1$$ is full, but I think this is too good to be true.

This question arises from the following context. When I was reading some article, I read that there is a bijection between the isomorphism class of principal $$G$$-bundles over $$M$$ and the homotopy class of maps from $$M$$ to $$BG$$. I wanted to verify this, so I found out that (1) if two maps $$f,g:M\to BG$$ are in the same homotopy class, $$f_*, g_*:\pi_1 M\to G$$ are conjugate, (2) a map $$M\to BG$$ induces a principal $$G$$-bundle, which is a pull back of $$EG\to BG$$, (3) if $$f_*, g_*$$ are in the same conjugacy class, the principal $$G$$-bundles induced by each of them are isomorphic to each other, where the isomorphism is $$p\mapsto hph^{-1}$$ where $$hf_*h^{-1}=g$$, and (4) a principal $$G$$-bundle $$N\to M$$ induces a group homomorphism $$\pi_1(M)\to G$$, since every loops on $$M$$ induces a $$G$$-action on $$M$$. I can deduce that the homotopy class of maps from $$M$$ to $$BG$$ gives an isomorphism class of principal $$G$$-bundles over $$M$$, but I am stuck on the converse statement. I think it is enough to prove that $$\pi_1(M)\to M$$ gives a continuous map $$M\to BG$$, and I presume that there is something with classifying space.

Yes, such a map $$f$$ does exist. In fact, it exists even when $$M$$ is a CW complex (and every smooth manifold has a CW complex structure) and when $$G$$ is an arbitrary group (not just a finite groups).
The proof is a straightforward obstruction theory argument. First pick a maximal tree in the 1-skeleton of $$M$$ and map that to the base point of $$BG$$. Next, each remanining 1-cell in $$M$$ represents an element of $$\pi_1(M)$$, map that edge to a loop in $$BG$$ representing the $$\phi$$ image of that element. Now extend over the 2-skeleton: the boundary of each 2-cell represents the trivial element of $$\pi_1(M)$$, so the image loop represents the trivial element of $$\pi_1(BG)$$, so you can extend the map continuously over that 2-cell. Now induct up the dimensions: assuming the map is defined on the $$n$$-skeleton for $$n \ge 2$$, for each $$n+1$$ cell the restriction of the map to the boundary of that cell is homotopically trivial, because $$\pi_n(BG)$$ is trivial, so the map can be extended continuously over the whole $$n+1$$ cell.
• When you say "$G$ is an arbitrary group" it still has to be discrete, otherwise $\pi_n(BG)$ isn't necessarily trivial for $n > 1$. – William Feb 3 at 17:39