Although ubiquitin is thought to be important for the autophagic sequestration of invading bacteria (also called xenophagy), its precise role remains largely enigmatic. Here we determined how ubiquitin is involved in this process. After invasion, ubiquitin is conjugated to host cellular proteins in endosomes that contain Salmonella or transfection reagent-coated latex (polystyrene) beads, which mimic invading bacteria. Ubiquitin is recognized by the autophagic machinery independently of the LC3-ubiquitin interaction through adaptor proteins, including a direct interaction between ubiquitin and Atg16L1. To ensure that invading pathogens are captured and degraded, Atg16L1 targeting is secured by two backup systems that anchor Atg16L1 to ubiquitin-decorated endosomes. Thus, we reveal that ubiquitin is a pivotal molecule that connects bacteriacontaining endosomes with the autophagic machinery upstream of LC3.