  In this work, we study the intersection cohomology of Siegel modular
varieties. The goal is to express the trace of a Hecke operator composed with a
power of the Frobenius endomorphism (at a good place) on this cohomology in
terms of the geometric side of Arthur's invariant trace formula for well-chosen
test functions.
  Our main tools are the results of Kottwitz about the contribution of the
cohomology with compact support and about the stabilization of the trace
formula, Arthur's $L^2$ trace formula and the fixed point formula of the
author. We "stabilize" this last formula, ie express it as a sum of stable
distributions on the general symplectic groups and its endoscopic groups, and
obtain the formula conjectured by Kottwitz.
  Applications of the results of this article have already been given by
Kottwitz, assuming Arthur's conjectures. Here, we give weaker unconditional
applications in the cases of the groups $\mathrm{GSp}_4$ and $\mathrm{GSp}_6$.
