  The Fermi LAT has opened the way for comparative studies of cosmic rays (CRs)
and high-energy objects in the Milky Way (MW) and in other, external,
star-forming galaxies. Using 2 yr of observations with the Fermi LAT, local
Group galaxy M31 was detected as a marginally extended gamma-ray source, while
only an upper limit (UL) has been derived for the other nearby galaxy M33. We
revisited the gamma-ray emission in the direction of M31 and M33 using more
than 7 yr of LAT Pass 8 data in the energy range 0.1-100 GeV, presenting
detailed morphological and spectral analyses. M33 remains undetected and we
computed an UL for it. This revised UL remains consistent with the observed
correlation between gamma-ray luminosity and star-formation rate tracers and
implies an average CR density in M33 that is at most half of that of the MW.
M31 is detected with a significance of nearly 10 sigma and to be extended with
4 sigma. Its spectrum is consistent with a power law. The spatial distribution
of the emission is consistent with a uniform disk with a radius of 0.4 deg and
no offset from the center of M31, but nonuniform intensity distributions cannot
be excluded. The flux from M31 appears confined to the inner regions of the
galaxy and does not fill the disk or extend far from it. The gamma-ray signal
is not correlated with regions rich in gas or star-formation activity
suggesting that the emission is not interstellar in origin, unless the
energetic particles radiating in gamma rays do not originate in recent star
formation. Alternative and nonexclusive interpretations are that the emission
results from a population of millisecond pulsars dispersed in the bulge and
disk of M31 by disrupted globular clusters or from the decay or annihilation of
dark matter particles, similar to what has been proposed to account for the
so-called Galactic Center excess found in Fermi-LAT observations of the MW.
