The flagellar stator unit is an oligomeric complex of two membrane proteins (MotA5B2) that powers bi-directional rotation of the bacterial flagellum. Harnessing the ion motive force across the cytoplasmic membrane, the stator unit operates as a miniature rotary motor itself to provide torque for rotation of the flagellum. Recent cryo-electron microscopic (cryo-EM) structures of the stator unit provided novel insights into its assembly, function, and subunit stoichiometry, revealing the ion flux pathway and the torque generation mechanism. Furthermore, in situ cryo-electron tomography (cryo-ET) studies revealed unprecedented details of the interactions between stator unit and rotor. In this review, we summarize recent advances in our understanding of the structure and function of the flagellar stator unit, torque generation, and directional switching of the motor.