  We study the fundamental group of the $p$-subgroup complex of a finite group
$G$. We show first that $\pi_1(A_3(A_{10}))$ is not a free group (here $A_{10}$
is the alternating group on $10$ letters). This is the first concrete example
in the literature of a $p$-subgroup complex with non-free fundamental group. We
prove that, modulo a well-known conjecture of M. Aschbacher, $\pi_1(A_p(G)) =
\pi_1(A_p(S_G)) * F$, where $F$ is a free group and $\pi_1(A_p(S_G))$ is free
if $S_G$ is not almost simple. Here $S_G = \Omega_1(G)/O_{p'}(\Omega_1(G))$.
This result essentially reduces the study of the fundamental group of
$p$-subgroup complexes to the almost simple case. We also exhibit various
families of almost simple groups whose $p$-subgroup complexes have free
fundamental group.
