But just as it seemed that all hope was lost, Arya destroyed the Night King, killing all the undead, and saving the world. Sansa was able to kill a few with some lucky knife stabs, but even she began to be overwhelmed.
However, the endless armies of undead breached Winterfell, and the Night King was able to ressurect the dead of House Stark, who proceeded to kill numerous civilians. Since Sansa had never received any military or combat training, she along with all noncombatants went into the Winterfell crypts for their safety. In addition, Theon and a group of Ironborn loyal to him arrived to help the Starks. At this time, Sansa was reunited with Tyrion Lannister, while they remained on good terms, they both agreed that their brief marriage would not have worked. Nontheless, the Northern armies, along with Dany's army of Unsullied and Dothraki readied themselves for the White Walkers invasion. The Golvers were so shocked, they withdrew their armies. Jon then revealed that in order to gain Dany's support, he bent the knee to her, much to the shock of the Northern Lords. Later, Jon returned to the North with Dany and her army, along with other allies who had helped him capture a wight to prove to the Lannisters that the White Walkers were real. Arya however, with her skills in assassination and espionage, and Sansa's gained experience of politics from her time as a political pawn and prisoner, along with Bran's greenseer power managed to turn the tables on Baelish and tried him of treason(Especially since he betrayed their father in the first place), and executed him, making Sansa popular with the Lords of the North and Vale. Lord Baelish, who had helped the Starks win the Battle of the Bastards, desired to seize the Iron Throne with Sansa as his queen and tried manipulating the two sisters against each other. While Jon was away, Arya and Bran returned to Winterfell.
Jon however, does sail for Dragonstone to negotiate an alliance. Jon decides he must negotiate an alliance, but Sansa has doubts of allying the North with Targaryeans. Jon then learns that Daenerys Targaryen has an large army and is invading Westeros to take the Iron Throne. But even so, the Northern army is still too small. Jon is then named King in the North and reveals that the Night King and his army of the undead are on the move to wipe out all life in the world, and orders all the northern armies to prepare for war, even being forced to conscript children as the North has lost many adult soldiers in Robb's campaign. However, Rickon did not survive the battle. Later, Sansa kills Ramsay by releasing his starving dogs on him. The ensuing Battle of the Bastards is a victory for House Stark, and Ramsay is captured.
After receiving a threatening letter from Ramsay, Sansa persuades Jon to help her rally the Free Folk, the smaller Northern houses and the remaining Tully forces in a quest to retake Winterfell and save Rickon. However, after the battle fails, she eventually escapes Winterfell with the aid of Theon Greyjoy and heads to Castle Black, reuniting with her half-brother, Jon Snow.
In the TV series, after escaping King's Landing, Sansa is persuaded by Baelish to marry Ramsay Bolton, as the upcoming threat of Stannis Baratheon's attack would free Winterfell from the Boltons' abusive hold. After the wedding between Joffrey and Margaery Tyrell, she escapes King's Landing under the protection of Lord Petyr Baelish, relocating in the Vale and pretending to be his bastard daughter, Alayne Stone. This has further negative effects on Sansa, who continues to be tortured by King Joffrey until the end of their betrothal when Sansa is married to his uncle, Tyrion Lannister. However, when her father discovers that Joffrey is, in fact, the bastard son born of incest between Cersei and her brother, Ser Jaime, he tries to crown Lord Stannis Baratheon as the new King after Robert's death and is executed in process. She is betrothed to Prince Joffrey Baratheon, son of King Robert I Baratheon and Queen Cersei Lannister, making her the future Queen of the Seven Kingdoms. Tyrion Lannister (first husband, unconsummated) Jon Snow (cousin in the show, half-brother in the books)