One hurdle to understanding how molecular machines work, and how they evolve, is our inability to see their structures in situ . Here we describe a minicell system that enables in situ cryogenic electron microscopy imaging and single particle analysis to investigate the structure of an iconic molecular machine, the bacterial flagellar motor, which spins a helical propeller for propulsion. We determine the structure of the high-torque Campylobacter jejuni motor in situ, including the subnanometre-resolution structure of the periplasmic scaffold, an adaptation essential to high torque. Our structure enables identification of new proteins, and interpretation with molecular models highlights origins of new components, reveals modifications of the conserved motor core, and explain how these structures both template a wider ring of motor proteins, and buttress the motor during swimming reversals. We also acquire insights into universal principles of flagellar torque generation. This approach is broadly applicable to other membrane-residing bacterial molecular machines complexes.