Summary Many pathogenic bacteria encase themselves in a polysaccharide capsule that provides a barrier to the physical and immunological challenges of the host. The mechanism by which the capsule assembles around the bacterial cell is unknown. Wzi, an integral outer-membrane protein from Escherichia coli, has been implicated in the formation of group 1 capsules. The 2.6 Å resolution structure of Wzi reveals an 18-stranded β-barrel fold with a novel arrangement of long extracellular loops that blocks the extracellular entrance and a helical bundle that plugs the periplasmic end. Mutagenesis shows that specific extracellular loops are required for in vivo capsule assembly. The data show that Wzi binds the K30 carbohydrate polymer and, crucially, that mutants functionally deficient in vivo show no binding to K30 polymer in vitro. We conclude that Wzi is a novel outer-membrane lectin that assists in the formation of the bacterial capsule via direct interaction with capsular polysaccharides.