A widespread system used by bacteria for protection against potentially dangerous foreign DNA molecules consists of the clustered regularly interspaced short palindromic repeats (CRISPR) coupled with cas (CRISPR-associated) genes. Similar to RNA interference in eukaryotes, these CRISPR/Cas systems use small RNAs for sequence-specific detection and neutralization of invading genomes. Here we describe the first examples of genes that mediate the inhibition of a CRISPR/Cas system. Five distinct 'anti-CRISPR' genes were found in the genomes of bacteriophages infecting Pseudomonas aeruginosa. Mutation of the anti-CRISPR gene of a phage rendered it unable to infect bacteria with a functional CRISPR/Cas system, and the addition of the same gene to the genome of a CRISPR/Cas-targeted phage allowed it to evade the CRISPR/Cas system. Phage-encoded anti-CRISPR genes may represent a widespread mechanism for phages to overcome the highly prevalent CRISPR/Cas systems. The existence of anti-CRISPR genes presents new avenues for the elucidation of CRISPR/Cas functional mechanisms and provides new insight into the co-evolution of phages and bacteria.