We show that Vibrio cholerae, the causative agent of cholera, use their flagella and mannose-sensitive hemagglutinin (MSHA) type IV pili synergistically to switch between two complementary motility states that together facilitate surface selection and attachment. Flagellar rotation counter-rotates the cell body, causing MSHA pili to have periodic mechanical contact with the surface for surface-skimming cells. Using tracking algorithms at 5 ms resolution we observe two motility behaviours: ‘roaming', characterized by meandering trajectories, and ‘orbiting’, characterized by repetitive high-curvature orbits. We develop a hydrodynamic model showing that these phenotypes result from a nonlinear relationship between trajectory shape and frictional forces between pili and the surface: strong pili–surface interactions generate orbiting motion, increasing the local bacterial loiter time. Time-lapse imaging reveals how only orbiting mode cells can attach irreversibly and form microcolonies. These observations suggest that MSHA pili are crucial for surface selection, irreversible attachment, and ultimately microcolony formation.