  We study the spectrum of the prompt emission and the X-ray and optical
afterglow fluxes of 54 X-Ray Rich Gamma Ray Burst (XRRs) and X-Ray Flashes
(XRFs), observed by BeppoSax and HETE-2. A comparison is then performed with
classical Gamma Ray Bursts (GRBs). The goal of this paper is to investigate the
nature of XRRs/XRFs, as high redshift GRBs or off-axis GRBs, analyzing both
their prompt and afterglow properties. We find that the XRR/XRF spectral
indexes of the Band function are similar to those of classical GRBs, whereas
the peak energy is lower by a factor of 4. We study the optical and X-Ray
afterglow properties of the XRRs/XRFs; in particular we analyze the XRR 011030
afterglow. We find that the X-ray and optical flux distributions and the
lightcurves of the XRRs/XRFs sample are consistent with those of classical
GRBs; in particular, they show evidence of a break and no rising temporal
slope. We compare these results with the afterglow predictions of the high
redshift scenario, where XRFs are GRBs at higher redshift and of the off-axis
scenario, where the observed differences are due to viewing angle effects. In
this last framework, we consider jets with a homogeneous, a -2 power-law shaped
and a Gaussian luminosity angular distribution.
  We find that the high redshift scenario can explain some events but not the
total sample of XRRs/XRFs. The off-axis model may be consistent with our
findings when a homogeneous jet is considered. However, given the uncertainties
on the selection effects in our sample, a Gaussian jet viewed at small angles
from the Gaussian core and a power-law shaped cannot be ruled out.
