The novel follows two protagonists: Ren Daiyan, a self-taught archer and swordsman whose fortuitous encounters with an up-and-coming magistrate lead him to become first an outlaw of the marsh and then a military officer, and Lin Shan, a talented ci poet given a man's education by her father.
After an encounter with the exiled poet Lu Chen thrusts her into the world of court intrigue in the imperial capital of Hanjin, Lin is introduced to Emperor Wenzong and eventually becomes a favored courtier.
This strategy fails disastrously, and after easily conquering the Xiaolu, the Altai mount a scorched-earth invasion of Kitai, violently sacking Hanjin and capturing most of the imperial family.
Ren, the only Kitan general capable of defeating Altai forces in the field, rescues Shan and an imperial heir, Prince Zhizheng, and conducts a fighting retreat to the south.
He quickly becomes a folk hero but is viewed with suspicion by his superiors, and is imprisoned on trumped-up treason charges when Zhizheng, to guard against his family's restoration in the north, proclaims himself emperor of a rump Kitan state and negotiates an unfavorable peace with the Altai.