As A Storm of Swords (2000) begins, Jon has infiltrated the wildlings and marches with their host. He learns that Mance Rayder intends to breach the Wall and march south to escape the Others, crushing the Night's Watch if necessary. Jon breaks his vows of celibacy with Ygritte and becomes torn between his growing feelings for her and his loyalty to the Night's Watch. After climbing over the Wall with Ygritte, Jon deserts them to warn the Watch of the impending attack. He helps defend Castle Black against the wildlings' attack despite his injuries. Ygritte is killed in battle, leaving Jon stricken with grief. Jon takes over Donal Noye's command of the Wall's defense after Noye is killed. When Thorne and Janos Slynt arrive at Castle Black, they attempt to have Jon executed for desertion. Jon is freed after the judges are convinced of his loyalty but Thorne orders Jon to kill Mance under the pretense of parley. As Jon negotiates with Mance, Stannis Baratheon arrives with his army and defeats the wildings. Stannis offers to legitimize Jon and declare him Lord of Winterfell if he will align the North with Stannis. Though greatly tempted by the prospect of becoming a true Stark, Jon ultimately chooses to remain loyal to his Night's Watch vows. Due to Sam's machinations, Jon is elected as the new Lord Commander in a landslide victory.
