Cas9 is a restriction enzyme involved in CRISPR, and used in gene editing.
Cas9 is used in the degradation of phage DNA, by allowing the targeting of the endonuclease activity - this is done by using guide RNAs transcribed from the spacers in the CRISPR loci. By targeting the cas9 endonuclease activity to the phage DNA with the guide RNA (gRNA), it can be selectively degraded and the bacterium survives the ‘attack’.