After the defeat of several Song armies in the north, Emperor Qinzong wanted to negotiate a truce with the Jin, but he committed a massive strategic blunder when he commanded his remaining armies to protect prefectural cities instead of Kaifeng. Neglecting the importance of the capital, he left Kaifeng defended with fewer than 100,000 soldiers. The Song forces were dispersed throughout China, powerless to stop the second Jurchen siege of the city. The Jin assault commenced in mid December 1126. Even as fighting raged on, Qinzong continued to sue for peace, but Jin demands for territory were enormous: they wanted all provinces north of the Yellow River. After more than twenty days of heavy combat against the besieging forces, Song defenses were decimated and the morale of Song soldiers was on the decline. On January 9, 1127, the Jurchens broke through and started to loot the conquered city. Emperor Qinzong tried to appease the victors by offering the remaining wealth of the capital. The royal treasury was emptied and the belongings of the city's residents were seized. The Song emperor offered his unconditional surrender a few days later. Qinzong, the former emperor Huizong, and members of the Song court were captured by the Jurchens as hostages. They were taken north to Huining , where they were stripped of their royal privileges and reduced to commoners. The former emperors were humiliated by their captors. They were mocked with disparaging titles like "Muddled Virtue" and "Double Muddled". In 1128 the Jin made them perform a ritual meant for war criminals. The harsh treatment of the Song royalty softened after the death of Huizong in 1135. Titles were granted to the deceased monarch, and his son Qinzong was promoted to Duke, a position with a salary.
Question: What happened first, the defeat of Song armies in the north, or Emperor Qinzong wanting to negotiate a truce with the Jin?
Answer: defeat of Song armies in the north