  Clusters of galaxies are the largest gravitationally-bound systems in the
Universe. Their dynamics are dominated by dark matter (DM), which makes them
among the best targets for indirect DM searches. We analyze 12 years of data
collected by the Fermi Large Area Telescope (Fermi-LAT) in the direction of 49
clusters of galaxies selected for their proximity to the Earth and their high
X-ray flux, which makes them the most promising targets. We first create
physically motivated models for the DM density around each cluster considering
different assumptions for the substructure distribution. Then we perform a
combined search for a $\gamma$-ray signal in the {\it Fermi}-LAT data between
500 MeV and 1 TeV. We find a signal of $\gamma$ rays potentially associated
with DM that is at a statistical significance of $2.5\sigma-3.0\sigma$ when
considering a slope for the subhalo mass distribution $\alpha=1.9$ and minimum
mass of $M_{\rm{min}}=10^{-6}$ $M_{\odot}$. The best-fit DM mass and
annihilation cross-sections for a $b\bar{b}$ annihilation channel are
$m_{\chi}=40-60$ GeV and $\langle \sigma v \rangle = (2-4) \times 10^{-25}$
cm$^3$/s. When we consider $\alpha=2.0$ and $M_{\rm{min}}=10^{-9}$ $M_{\odot}$,
the best-fit of the cross section reduces to $\langle \sigma v \rangle = (4-10)
\times 10^{-26}$ cm$^3$/s. For both DM substructure models there is a tension
between the values of $\langle \sigma v \rangle$ that we find and the upper
limits obtained with the non-detection of a $\gamma$-ray flux from Milky Way
dwarf spheroidal galaxies. This signal is thus more likely associated with
$\gamma$ rays produced in the intracluster region by cosmic rays colliding with
gas and photon fields.
