CRISPR-Cas9 is the state-of-the-art technology for editing and manipulating nucleic acids. However, the occurrence of off-target mutations can limit its applicability. Here, all-atom enhanced molecular dynamics (MD) simulations-using Gaussian accelerated MD (GaMD)-are used to decipher the mechanism of off-target binding at the molecular level. GaMD reveals that base pair mismatches in the target DNA at distal sites with respect to the protospacer adjacent motif (PAM) can induce an extended opening of the RNA:DNA heteroduplex, which leads to newly formed interactions between the unwound DNA and the L2 loop of the catalytic HNH domain. These conserved interactions constitute a "lock" effectively decreasing the conformational freedom of the HNH domain and hampering its activation for cleavage. Remarkably, depending on their positions at PAM distal sites, DNA mismatches responsible for off-target cleavages are unable to "lock" the HNH domain, thereby leading to the unselective cleavage of DNA sequences. In consistency with the available experimental data, the ability to "lock" the catalytic HNH domain in an inactive "conformational checkpoint" is shown to be a key determinant in the onset of off-target effects. This mechanistic rationale contributes in clarifying a long lasting open issue in the CRISPR-Cas9 function and poses the foundation for designing novel and more specific Cas9 variants, which could be obtained by magnifying the "locking" interactions between HNH and the target DNA in the presence of any incorrect off-target sequence, thus preventing undesired cleavages.