ABSTRACT: The human gait program involves many brain areas such as motor cortices, cerebellum, basal ganglia, brainstem, and spinal cord. The mesencephalic locomotor region (MLR), which contains the pedunculopontine (PPN) and cuneiform (CN) nuclei, is thought to be one of the key supraspinal gait generators. In daily life activities, gait primarily occurs in complex conditions, such as through narrow spaces, or while changing direction or performing motor or cognitive tasks. Here, we aim to explore the activity of these subcortical brain areas while walking through narrow spaces, using functional MRI in healthy volunteers and designing a virtual reality task mimicking walking down a hallway, without and with an open doorway to walk through. As a control, we used a virtual moving walkway in the same environment. Twenty healthy volunteers were scanned. Fifteen subjects were selected for second level analysis based on their ability to activate motor cortices. Using the contrast Gait versus Walkway, we found activated clusters in motor cortices, cerebellum, red nucleus, thalamus, and the left MLR including the CN and PPN. Using the contrast Gait with Doorway versus Walkway with Doorway, we found activated clusters in motor cortices, left putamen, left internal pallidum, left substantia nigra, right subthalamic area, and bilateral MLR involving the CN and PPN. Our results suggest that unobstructed gait involves a motor network including the PPN whereas gait through a narrow space requires the additional participation of basal ganglia and bilateral MLR, which may encode environmental cues to adapt locomotion.