  We prove that for any given compact Riemannian manifold $N$ of dimension $n+1
\geq 3$ and any non-negative Lipschitz function $g$ on $N$, there exists a
quasi-embedded, boundaryless hypersurface $M \subset N,$ of class $C^{2,
\alpha}$ for any $\alpha \in (0,1),$ such that $M$ is the image of a two-sided
immersion whose mean curvature is given by $g\nu$ for an appropriate choice of
continuous unit normal $\nu$ to the immersion; and moreover, the singular set
$\Sigma = \overline{M} \setminus M$ is empty if $2 \leq n \leq 6,$ finite if
$n=7$ and satisfies ${\mathcal H}^{n-7 + \gamma}(\Sigma) = 0$ for every $\gamma
>0$ if $n \geq 8$. Here quasi-embedded means that near every non-embedded
point, $M$ is the union of two embedded $C^{2, \alpha}$ disks intersecting
tangentially with each disk lying on one side of the other. If $g >0$ then
$\overline{M}$ is the boundary of a Caccioppoli set. Our proof of this theorem
is PDE theoretic and relies, when $g>0$ and $g\in C^{1,1}(N)$, on (i) a
mountain pass construction of solutions to the inhomogeneous Allen--Cahn
equation and (ii) a regularity result for integral varifolds arising from a
Morse-index bounded, energy bounded, sequence of solutions to the
(inhomogeneous) Allen--Cahn equation. The case of non-negative Lipschitz $g$
follows by approximation, based on the estimates that we establish.
