  The origin of the gamma-ray emission from M87 is currently a matter of
debate. This work aims to localize the VHE (100 GeV-100 TeV) gamma-ray emission
from M87 and probe a potential extended hadronic emission component in the
inner Virgo Cluster. The search for a steady and extended gamma-ray signal
around M87 can constrain the cosmic-ray energy density and the pressure exerted
by the cosmic rays onto the intra-cluster medium, and allow us to investigate
the role of the cosmic rays in the active galactic nucleus feedback as a
heating mechanism in the Virgo Cluster. H.E.S.S. telescopes are sensitive to
VHE gamma rays and have been utilized to observe M87 since 2004. We utilized a
Bayesian block analysis to identify M87 emission states with H.E.S.S.
observations from 2004 until 2021, dividing them into low, intermediate, and
high states. Because of the causality argument, an extended ($\gtrsim$kpc)
signal is allowed only in steady emission states. Hence, we fitted the
morphology of the 120h low state data and found no significant gamma-ray
extension. Therefore, we derived for the low state an upper limit of
58"(corresponding to $\approx$4.6kpc) in the extension of a single-component
morphological model described by a rotationally symmetric 2D Gaussian model at
99.7% confidence level. Our results exclude the radio lobes ($\approx$30 kpc)
as the principal component of the VHE gamma-ray emission from the low state of
M87. The gamma-ray emission is compatible with a single emission region at the
radio core of M87. These results, with the help of two multiple-component
models, constrain the maximum cosmic-ray to thermal pressure ratio
$X_{{CR,max.}}$$\lesssim$$0.32$ and the total energy in cosmic-ray protons
(CRp) to $U_{CR}$$\lesssim$5$\times10^{58}$ erg in the inner 20kpc of the Virgo
Cluster for an assumed CRp power-law distribution in momentum with spectral
index $\alpha_{p}$=2.1.
