In order to simulate the effects of the heavy ion component of cosmic rays on ices in astrophysical environments, the CO and CO2 ices were irradiated with swift nickel ions in the electronic energy loss regime. The ices were prepared by condensing gas onto a CsI substrate at a temperature of 14 K and analyzed by means of infrared (FTIR) spectroscopy. The physical process of deposition by Ni ions is similar to more important and abundant heavy cosmic rays such as Fe ions. Dissociation of the ice molecules, and formation of new molecules were observed. Also, sputtering (leading to desorption of molecules from the solid surface to the gas phase) was observed. It was found that the sputtering yield due to heavy ions cannot be neglected with respect to desorption induced by weakly ionizing particles such as UV photons and protons.