Single-stranded RNA bacteriophages (ssRNA phages) infect Gram-negative bacteria via a single maturation protein (Mat), which attaches to a retractile pilus of the host. Here we present structures of the ssRNA phage MS2 in complex with the Escherichia coli F-pilus, showing a network of hydrophobic and electrostatic interactions at the Mat-pilus interface. Moreover, binding of the pilus induces slight orientational variations of the Mat relative to the rest of the phage capsid, priming the Mat-connected genomic RNA (gRNA) for its release from the virions. The exposed tip of the attached Mat points opposite to the direction of the pilus retraction, which may facilitate the translocation of the gRNA from the capsid into the host cytosol. In addition, our structures determine the orientation of the assembled F-pilin subunits relative to the cell envelope, providing insights into the F-like type IV secretion systems.