In the 13th century, the Mongol leader Genghis Khan, once a vassal of the Jurchens, rose up against the Jin dynasty. In the ensuing Mongol conquest of the Jin dynasty, the nomadic invaders avoided direct attacks on the Jin fortifications. Instead, when they could, the Mongols simply rode around the walls; an effective example of this tactic is in 1211, when they circumvented the substantial fortress in Zhangjiakou and inflicted a terrible defeat upon the Jin armies at the Battle of Yehuling. The Mongols also took advantage of lingering Liao resentment against the Jin; the Khitan defenders of the garrisons along the Jin walls, such as those in Gubeikou, often preferred to surrender to the Mongols rather than fight them. The only major engagement of note along the main Great Wall line was at the heavily defended Juyong Pass: instead of laying siege, the Mongol general Jebe lured the defenders out into an ambush and charged in through the opened gates. In 1215, Genghis Khan besieged, captured, and sacked the Jin capital of Yanjing (modern-day Beijing). The Jin dynasty eventually collapsed following the siege of Caizhou in 1234. Western Xia had already fallen in 1227, and the Southern Song resisted the Mongols until 1279.