The bacterial flagellar motor is an amazing nanomachine: built from approximately 25 different proteins, it uses an electrochemical ion gradient to drive rotation at speeds of up to 300 Hz (refs 1, 2). The flagellar motor consists of a fixed, membrane-embedded, torque-generating stator and a typically bidirectional, spinning rotor that changes direction in response to chemotactic signals. Most structural analyses so far have targeted the purified rotor, and hence little is known about the stator and its interactions. Here we show, using electron cryotomography of whole cells, the in situ structure of the complete flagellar motor from the spirochaete Treponema primitia at 7 nm resolution. Twenty individual motor particles were computationally extracted from the reconstructions, aligned and then averaged. The stator assembly, revealed for the first time, possessed 16-fold symmetry and was connected directly to the rotor, C ring and a novel P-ring-like structure. The unusually large size of the motor suggested mechanisms for increasing torque and supported models wherein critical interactions occur atop the C ring, where our data suggest that both the carboxy-terminal and middle domains of FliG are found.