  We study amenability of definable and topological groups.
  Among our main technical tools is an elaboration on and strengthening of the
Massicot-Wagner version of the stabilizer theorem, and some results around
measures.
  As an application we show that if $G$ is an amenable topological group, then
the Bohr compactification of $G$ coincides with a certain "weak Bohr
compactification" introduced in [24]. Formally, $G^{00}_{topo} =
G^{000}_{topo}$. We also prove wide generalizations of this result, implying in
particular its extension to a "definable-topological" context, confirming the
main conjectures from [24].
  We introduce $\bigvee$-definable group topologies on a given
$\emptyset$-definable group $G$ (including group topologies induced by
type-definable subgroups as well as uniformly definable group topologies), and
prove that the existence of a mean on the lattice of closed, type-definable
subsets of $G$ implies (under some assumption) that $cl(G^{00}_M) =
cl(G^{000}_M)$ for any model $M$.
  We study the relationship between definability of an action of a definable
group on a compact space, weakly almost periodic actions, and stability. We
conclude that for any group $G$ definable in a sufficiently saturated
structure, every definable action of $G$ on a compact space supports a
$G$-invariant probability measure. This gives negative solutions to some
questions and conjectures from [22] and [24].
  We give an example of a $\emptyset$-definable approximate subgroup $X$ in a
saturated extension of the group $\mathbb{F}_2 \times \mathbb{Z}$ in a suitable
language for which the $\bigvee$-definable group $H:=\langle X \rangle$
contains no type-definable subgroup of bounded index. This refutes a conjecture
by Wagner and shows that the Massicot-Wagner approach to prove that a locally
compact "model" exists for each approximate subgroup does not work in general.
