Pseudomonas aeruginosa can attach to surfaces via its polar flagellum; following irreversible attachment, changes in gene expression promote surface colonization and biofilm formation. Schniederberend et al. show that modulation of flagellar rotation is another strategy used by surface-attached bacteria to promote persistence at the surface. Wild-type P. aeruginosa cells stopped flagellar rotation shortly after surface attachment, whereas mutants lacking FlhF, a GTPase required for polar flagellar placement, did not. FlhF was shown to interact with the flagellar rotor component FliG, and with the polar scaffolding protein FimV, which regulates the production of cAMP. The FlhF–FimV interaction was required to stop flagellar rotation and led to an increase in intracellular cAMP levels. Cells lacking FlhF or FimV exhibited persistent flagellar rotation, an effect that could be rescued by exogenous cAMP, implicating cAMP signalling in the modulation of flagellar rotation.