How attraction turns to repulsion