  A subgroup $H$ of a group $G$ is confined if the $G$-orbit of $H$ under
conjugation is bounded away from the trivial subgroup in the space
$\operatorname{Sub}(G)$ of subgroups of $G$. We prove a commutator lemma for
confined subgroups. For groups of homeomorphisms, this provides the exact
analogue for confined subgroups (hence in particular for URSs) of the classical
commutator lemma for normal subgroups: if $G$ is a group of homeomorphisms of a
Hausdorff space $X$ and $H$ is a confined subgroup of $G$, then $H$ contains
the derived subgroup of the rigid stabilizer of some open subset of $X$. We
apply this commutator lemma in the setting of groups acting on rooted trees. We
prove a theorem describing the structure of URSs of weakly branch groups and of
their non-topologically free minimal actions. Among the applications of these
results, we show: 1) if $G$ is a finitely generated branch group, the
$G$-action on $\partial T$ has the smallest possible growth among all faithful
$G$-actions; 2) if $G$ is a finitely generated branch group, then every
embedding from $G$ into a group of homeomorphisms of strongly bounded type
(e.g. a bounded automaton group) must be spatially realized; 3) if $G$ is a
finitely generated weakly branch group, then $G$ does not embed into the group
IET of interval exchange transformations.
