As the atoms approach one another, the electrons concentrate between the nuclei, and attraction occurs. Hence, the potential energy decreases. At very short distances, the electrons would be squeezed out. As a result, the two positively charged nuclei will experience a repulsive force due to the other.