The lactose repressor protein may bind DNA in two possible configurations: a specific one, if the DNA sequence corresponds to a binding site, and a non-specific one otherwise. To find its target sequences, the lactose repressor first binds non-specifically to DNA, and subsequently, it rapidly searches for a binding site. Atomic structures of non-specific and specific complexes are available from crystallographic and nuclear magnetic resonance experiments. However, what remains unknown is a detailed description of the steps that transform the non-specific complex into the specific one. Here, how the protein first recognizes its binding site has been studied using molecular dynamics simulations. The picture that emerges is that of a protein that is as mobile when interacting with non-specific DNA sequences as when free in solution. This high degree of mobility allows the protein to rapidly sample different DNA sequences. In contrast, when the protein encounters a binding site, the configuration ensemble collapses, and the protein sliding movements along the DNA sequence become scarce. The binding energies in the specific and non-specific complexes were analysed using the Molecular Mechanics Poisson Boltzmann Surface Area approach. These results represent a first step towards a throughout characterization of the DNA-recognition process.