Tumu Crisis
Also called: Battle of Tumu Fortress, Tumu Incident
When Esen of the Oirats invaded in 1449, the Ming Zhengtong Emperor, urged on by the eunuch Wang Zhen, took the field himself and was routed and captured at Tumu. Yu Qian set a new emperor on the throne and held Beijing, and thereafter the Ming stood on the defensive in the north.

Unknown author · Public domain · Source
After Yongle the western Mongols, the Oirats, grew strong on the steppe, and Esen united many Mongol tribes. When Esen, quarrelling with the Ming over the terms of tribute trade, invaded in 1449, the young Zhengtong Emperor, urged by the eunuch Wang Zhen, led out a huge army said to number half a million. Ill-prepared, it was surrounded at Tumu northwest of Beijing on the way back, crushed, and the emperor taken prisoner.
Vice minister of war Yu Qian rejected calls to move south, put the emperor’s brother on the throne as the Jingtai Emperor and defended Beijing. Released and sent home, Zhengtong regained the throne in a coup in 1457. After Tumu the Ming gave up campaigns into Mongolia for defence, and most of the brick Great Wall that survives today was built afterwards.