Bacteria resist phage infection through restriction modification systems that degrade foreign DNA , and a system that uses CRISPR sequences to retain fragments of the genomes of phage that the bacteria have come into contact with in the past , which allows them to block virus replication through a form of RNA interference .