  Let $X$ be a modular curve and consider a sequence of Galois orbits of CM
points in $X$, whose $p$-conductors tend to infinity. Its equidistribution
properties in $X({\bf C})$ and in the reductions of $X$ modulo primes different
from $p$ are well understood. We study the equidistribution problem in the
Berkovich analytification $X_{p}^{\rm an}$ of $X_{{\bf Q}_{p}}$.
  We partition the set of CM points of sufficiently high conductor in $X_{{\bf
Q}_{p}}$ into finitely many explicit `basins' $B_{V}$, indexed by the
irreducible components $V $ of the mod-$p$ reduction of the canonical model of
$X$. We prove that a sequence $z_{n}$ of local Galois orbits of CM points with
$p$-conductor going to infinity has a limit in $X_{p}^{\rm an}$ if and only if
it is eventually supported in a single basin $B_{V}$. If so, the limit is the
unique point of $X_{p}^{\rm an}$ whose mod-$p$ reduction is the generic point
of $V$.
  The result is proved in the more general setting of Shimura curves over
totally real fields. The proof combines Gross's theory of quasicanonical
liftings with a new formula for the intersection numbers of CM curves and
vertical components in a Lubin--Tate space.
