Several systems, including contractile tail bacteriophages, the type VI secretion system and R-type pyocins, use a multiprotein tubular apparatus to attach to and penetrate host cell membranes. This macromolecular machine resembles a stretched, coiled spring (or sheath) wound around a rigid tube with a spike-shaped protein at its tip. A baseplate structure, which is arguably the most complex part of this assembly, relays the contraction signal to the sheath. Here we present the atomic structure of the approximately 6-megadalton bacteriophage T4 baseplate in its pre- and post-host attachment states and explain the events that lead to sheath contraction in atomic detail. We establish the identity and function of a minimal set of components that is conserved in all contractile injection systems and show that the triggering mechanism is universally conserved.