  Clusters of galaxies are expected to be reservoirs of cosmic rays (CRs) that
should produce diffuse gamma-ray emission due to their hadronic interactions
with the intra-cluster medium. The nearby Perseus cool-core cluster, identified
as the most promising target to search for such an emission, has been observed
with the MAGIC telescopes at very-high energies (VHE, E>100 GeV) for a total of
253 hr from 2009 to 2014. The active nuclei of NGC 1275, the central dominant
galaxy of the cluster, and IC 310, lying at about 0.6$^\circ$ from the centre,
have been detected as point-like VHE gamma-ray emitters during the first phase
of this campaign. We report an updated measurement of the NGC 1275 spectrum,
which is well described by a power law with a photon index of
$3.6\pm0.2_{stat}\pm0.2_{syst}$ between 90 GeV and 1.2 TeV. We do not detect
any diffuse gamma-ray emission from the cluster and set stringent constraints
on its CR population. In order to bracket the uncertainties over the CR spatial
and spectral distributions, we adopt different spatial templates and power-law
spectral indexes $\alpha$. For $\alpha=2.2$, the CR-to-thermal pressure within
the cluster virial radius is constrained to be below 1-2%, except if CRs can
propagate out of the cluster core, generating a flatter radial distribution and
releasing the CR-to-thermal pressure constraint to <20%. Assuming that the
observed radio mini-halo of Perseus is generated by secondary electrons from CR
hadronic interactions, we can derive lower limits on the central magnetic
field, $B_0$, that depend on the CR distribution. For $\alpha=2.2$,
$B_0\gtrsim5-8 \mu$G, which is below the 25 $\mu$G inferred from Faraday
rotation measurements, whereas, for $\alpha\lesssim2.1$, the hadronic
interpretation of the diffuse radio emission is in contrast with our gamma-ray
flux upper limits independently of the magnetic field strength.
