The Nine Gates Infantry Commander (Chinese: 步軍統領/九門提督; pinyin: bùjūn tónglǐng/jiǔmén tídū) was a military appointment used in the Qing dynasty (1644–1912) of China. The officer holding this appointment was in charge of safeguarding and monitoring traffic, and overseeing the opening times of the nine gates of the imperial capital, Beijing. The nine gates were Zhengyang Gate, Chongwen Gate, Anding Gate, Fucheng Gate, Xizhi Gate, Dongzhi Gate, Xuanwu Gate, Desheng Gate, and Chaoyang Gate. The officer's judicial responsibilities included night patrol, fire fighting, security checks of civilians, the apprehension and arrest of criminals, and prison keeping. He was also responsible for the security of the Forbidden City. Throughout the history of the Qing dynasty, the position was always held by Manchus rather than Han Chinese.
The appointment was created in around 1644 when the forces of the Manchu-led Qing dynasty occupied Beijing, formerly the capital of the Ming dynasty, and established the Qing imperial capital there. The appointment holder's responsibilities were primarily to oversee the city's defences and security within the city. He was also in charge of the infantry units within the Eight Banners and the guards of the nine gates of Beijing. At the same time, he was also the commander of the north and south patrol units from the Green Standard Army. The infantry units were all stationed at specific locations within Beijing's inner city to defend that particular place. The patrol units maintained security in the outer city and strategic places in Beijing's outskirts.
In 1659, during the reign of the Shunzhi Emperor, the Qing government created a central patrol unit and put it under the charge of the Nine Gates Infantry Commander. The full name of the appointment was "Commander of the Infantry of the Nine Gates and Three Patrol Units" (提督九門步軍巡捕三營統領). As the Nine Gates Infantry Commander was an important position, the Qing government had been reluctant to appoint any non-Manchu officer to this position for fear that a rebellion might occur.
In 1781, during the reign of the Qianlong Emperor, the Qing government increased the number of patrol units from three to five and put them under the charge of the Nine Gates Infantry Commander. The appointment was thus known as "Commander of the Infantry of the Nine Gates and Five Patrol Units" (提督九門步軍巡捕五營統領).
In 1900, when the forces of the Eight-Nation Alliance occupied Beijing during the Boxer Rebellion, they created a public security office to maintain security within the city. The last person to hold the appointment of Nine Gates Infantry Commander before the foreign invasion was Ronglu, an official deeply trusted by Empress Dowager Cixi. After the Boxer Rebellion ended, in 1901, the Qing government abolished the appointment of Nine Gates Infantry Commander and created a centralised police command to replace the original five patrol units. In 1902, Shanqi (Prince Su), who strongly supported the idea of separating the military from the police, was appointed as the infantry commander. In 1905, the Qing government implemented reforms which officially separated the police units from the infantry units and established a separate police force, as well as a police school to train police officers.
After the 1911 Xinhai Revolution, the Beiyang Government, which took over Beijing, retained the appointment of Nine Gates Infantry Commander but renamed it to "High Command of the Infantry of the Capital" (京師步軍統領衙門). The appointment holder was in charge of the left and right wings of the Beiyang armed forces. The appointment was officially abolished in November 1924.