  We consider the distribution of the Galois groups
$\operatorname{Gal}(K^{\operatorname{un}}/K)$ of maximal unramified extensions
as $K$ ranges over $\Gamma$-extensions of $\mathbb{Q}$ or $\mathbb{F}_q(t)$. We
prove two properties of $\operatorname{Gal}(K^{\operatorname{un}}/K)$ coming
from number theory, which we use as motivation to build a probability
distribution on profinite groups with these properties. In Part I, we build
such a distribution as a limit of distributions on $n$-generated profinite
groups. In Part II, we prove as $q\rightarrow\infty$, agreement of
$\operatorname{Gal}(K^{\operatorname{un}}/K)$ as $K$ varies over totally real
$\Gamma$-extensions of $\mathbb{F}_q(t)$ with our distribution from Part I, in
the moments that are relatively prime to $q(q-1)|\Gamma|$. In particular, we
prove for every finite group $\Gamma$, in the $q\rightarrow\infty$ limit, the
prime-to-$q(q-1)|\Gamma|$-moments of the distribution of class groups of
totally real $\Gamma$-extensions of $\mathbb{F}_q(t)$ agree with the prediction
of the Cohen--Lenstra--Martinet heuristics.
