Bacteria have restriction enzymes, also called restriction endonucleases, which cleave double stranded DNA at specific points into fragments, which are then degraded further by other endonucleases. This prevents infection by effectively destroying the foreign DNA introduced by an infectious agent (such as a bacteriophage). Approximately one quarter of known bacteria possess RM systems and of those about one half have more than one type of system.
Restriction enzymes only cleave at specific sequences of DNA which are usually 4-6 base pairs long, and often palindromic. Given that the sequences that the restriction enzymes recognize are very short, the bacterium itself will almost certainly have many of these sequences present in its own DNA. Therefore, in order to prevent destruction of its own DNA by the restriction enzymes, the bacterium marks its own DNA by adding methyl groups to it. This modification must not interfere with the DNA base-pairing, and therefore, usually only a few specific bases are modified on each strand.
Type I systems are the most complex, consisting of three polypeptides: R (restriction), M (modification), and S (specificity). The resulting complex can both cleave and methylate DNA. Both reactions require ATP, and cleavage often occurs a considerable distance from the recognition site. The S subunit determines the specificity of both restriction and methylation. Cleavage occurs at variable distances from the recognition sequence, so discrete bands are not easily visualized by gel electrophoresis.
Type II systems are the simplest and the most prevalent. Instead of working as a complex, the methytransferase and endonuclease are encoded as two separate proteins and act independently (there is no specificity protein). Both proteins recognize the same recognition site, and therefore compete for activity. The methyltransferase acts as a monomer, methylating the duplex one strand at a time. The endonuclease acts as a homodimer, which facilitates the cleavage of both strands. Cleavage occurs at a defined position close to or within the recognition sequence, thus producing discrete fragments during gel electrophoresis. For this reason, Type II systems are used in labs for DNA analysis and gene cloning.
Type III systems have R and M proteins that form a complex of modification and cleavage. The M protein, however, can methylate on its own. Methylation also only occurs on one strand of the DNA unlike most other known mechanisms. The heterodimer formed by the R and M proteins competes with itself by modifying and restricting the same reaction. This results in incomplete digestion.
Some viruses have evolved ways of subverting the restriction modification system, usually by modifying their own DNA, by adding methyl or glycosyl groups to it, thus blocking the restriction enzymes. Other viruses, such as bacteriophages T3 and T7, encode proteins that inhibit the restriction enzymes.
To counteract these viruses, some bacteria have evolved restriction systems which only recognize and cleave modified DNA, but do not act upon the host's unmodified DNA. Some prokaryotes have developed multiple types of restriction modification systems.