  Motivated by the quasi-local mass problem in general relativity, we study the
rigidity of isometric immersions with the same mean curvature into a warped
product space. As a corollary of our main result, two star-shaped hypersurfaces
in a spatial Schwarzschild or AdS-Schwarzschild manifold with nonzero mass
differ only by a rotation if they are isometric and have the same mean
curvature. We also give similar results if the mean curvature condition is
replaced by an $\sigma_2$-curvature condition.
