The flagellar machinery is a highly complex organelle composed of a free rotating flagellum and a fixed stator that converts energy into movement. The assembly of the flagella and the stator requires interactions with the peptidoglycan layer through which the organelle has to pass for externalization. Lytic transglycosylases are peptidoglycan degrading enzymes that cleave the sugar backbone of peptidoglycan layer. We show that an endogenous lytic transglycosylase is required for full motility of Helicobacter pylori and colonization of the gastric mucosa. Deficiency of motility resulted from a paralysed phenotype implying an altered ability to generate flagellar rotation. Similarly, another Gram-negative pathogen Salmonella typhimurium and the Gram-positive pathogen Listeria monocytogenes required the activity of lytic transglycosylases, Slt or MltC, and a glucosaminidase (Auto), respectively, for full motility. Furthermore, we show that in absence of the appropriate lytic transglycosylase, the flagellar motor protein MotB from H. pylori does not localize properly to the bacterial pole. We present a new model involving the maturation of the surrounding peptidoglycan for the proper anchoring and functionality of the flagellar motor.