In July 1449, Esen Tayisi of the Oirat Mongols launched a large-scale invasion of China. His army and the Ming army personally led by Emperor Yingzong met at Tumubao, west of Huailai County. The Ming army was defeated and the Ming emperor was captured. This battle is known as the Tumu Crisis in history.
When the news of the conflict reached the capital, the court without its emperor and the whole capital city was thrown into a panic, knowing that Beijing was only defended by an army of less than 100,000 soldiers and only one tenth of these were armed. Chancellors at the court cried out for help and wealthy families planned to flee.
A few days later, Empress Dowager Sun ordered Zhu Qiyu, brother of the emperor, to act in the place of the emperor. Zhu Qiyu called in the chancellors. Xu Cheng, hanlin shijiang (an official title), suggested moving the capital to Nanjing, while Defense Minister Yu Qian insisted on resisting the invasion and his advice was at last adopted. In September, at the suggestion of Yu Qian and other ministers, Zhu Qiyu was installed by the Empress Dowager as Emperor Jingtai, and Emperor Yingzong who was still held by the Mongols was considered to be the retired emperor. At that critical moment, Yu Qian was at the helm as commander. Yu Qian (1398–1457) was born in Qiantang in Zhejiang and was a jinshi. As a government official, he was known for his honesty. He reinforced the defense forces by redeploying troops to Beijing, transporting grains from surrounding suburbs to the city, calling in dismissed soldiers, and collecting abandoned weapons at the Tumubao battlefield. He also punished runaway generals and officials, particularly Wang Zheng and his followers who were largely responsible for the defeat. The army and the people were greatly encouraged by his measures, and his army soon rose to 220,000 soldiers.
Esen did not withdraw but instead launched another campaign on the Ming. Soon the Oirat army arrived at Beijing and camped outside one of the city gates, Xizhimen. Yu Qian ordered his generals to array their troops outside all nine city gates, and he personally led an army to meet the main troops of the enemy at Deshengmen. To encourage the army and the people of Beijing to defend their city, Yu Qian announced his order of rewarding those who worked to repel the assault and punishing those who did nothing to prevent the attack.
At first, Esen was confident that he would capture Beijing, but his plan was soon foiled. He was somewhat daunted to see that under the steadfast leadership of Yu Qian, the Ming soon turned this unfavorable situation to their advantage. Not only did he use Beijing’s fortifications relatively well, but he also deployed various schemes to destroy Mongol morale. At one point, he commanded his forces to pretend to lose control of the city gates and lure a large force of Mongol riders into the city. Once a portion of the Mongols were inside, the gates were shut and the Mongols inside were ambushed. The Mongols lost 10,000 people and a cavalry of 90,000 was defeated. By the end of October, Esen and his surviving army were forced to leave Beijing for Jingzhou with Emperor Yingzong. The Ming army drove them as far as the north of the Great Wall by mid-November.
Emperor Yingzong was released and returned to Beijing soon after the victory. In 1457, he regained the throne with the help of Xu Cheng and Eunuch Cao Jinqiang when Emperor Jingzong (Zhu Qiyu) was very ill. This is historically known as the Duomen Incident.