  HCl and HF are expected to be the main reservoirs of fluorine and chlorine
wherever hydrogen is predominantly molecular. They are found to be strongly
depleted in dense molecular clouds, suggesting freeze-out onto grains in such
cold environments. We can then expect that HCl and HF were also the major
carriers of Cl and F in the gas and icy phases of the outer solar nebula, and
were incorporated into comets. We aimed to measure the HCl and HF abundances in
cometary ices as they can provide insights on the halogen chemistry in the
early solar nebula. We searched for the J(1-0) lines of HCl and HF at 626 and
1232 GHz, respectively, using the HIFI instrument on board the Herschel Space
Observatory. HCl was searched for in comets 103P/Hartley 2 and C/2009 P1
(Garradd), whereas observations of HF were conducted in comet C/2009 P1. In
addition, observations of H$_2$O and H$_2^{18}$O lines were performed in C/2009
P1 to measure the H$_2$O production rate. Three lines of CH$_3$OH were
serendipitously observed in the HCl receiver setting. HCl is not detected,
whereas a marginal (3.6-$\sigma$) detection of HF is obtained. The upper limits
for the HCl abundance relative to water are 0.011% and 0.022%, for 103P and
C/2009 P1, respectively, showing that HCl is depleted with respect to the solar
Cl/O abundance by a factor more than 6$^{+6}_{-3}$ in 103P, where the error is
related to the uncertainty in the chlorine solar abundance. The marginal HF
detection obtained in C/2009 P1 corresponds to an HF abundance relative to
water of (1.8$\pm$0.5) $\times$ 10$^{-4}$, which is approximately consistent
with a solar photospheric F/O abundance. The observed depletion of HCl suggests
that HCl was not the main reservoir of chlorine in the regions of the solar
nebula where these comets formed. HF was possibly the main fluorine compound in
the gas phase of the outer solar nebula.
