Abstract The near-surface swimming patterns of bacteria are determined by hydrodynamic interactions between the bacteria and the surface, which trap the bacteria in smooth circular trajectories that lead to inefficient surface exploration. Here, we combine experiments with a data-driven mathematical model to show that the surface exploration of a pathogenic strain of Escherichia coli results from a complex interplay between motility and transient surface adhesion events.