Before they could invade the Song , the Jurchens reached a peace agreement with their western neighbors the Tangut Western Xia in 1124 . The following year near the Ordos Desert , they captured Tianzuo , the last emperor of the Liao , putting an end to the Liao dynasty for good . Ready to end their alliance with the Song , the Jurchens began preparations for an invasion .