Size determination represents a fundamental requirement for multicomponent biological structures. Some pathogenic bacteria possess a weapon derived from the flagellum. Like the flagellum, this type-III secretion apparatus, called the injectisome, has a transmembrane basal body, but the external component is a needle-like structure instead of a hook and a filament. Here, we provide evidence that the length of this needle is determined by the size of a protein, YscP, acting as a molecular ruler.