Di Yun, Ng Yuen-Jun, a student of the renowned martial artist Qi Zhangfa, is sentenced to death on charges of larceny and rape. He proclaims his innocence, claiming that he had been set up, but is ignored by the sadistic jailers who regularly taunt and abuse him, and is horrified by their treatment of another inmate, Ding Dian Jason Pai Piao, whom they and the presiding magistrate, Ling Tuisi Elliot Ngok Wah seem to torture purely out of pleasure.
Di Yun is later visited by his martial arts seniors Wan Gui Dick Wei and Qi Fang Liu Lai-ling, Di Yun's childhood sweetheart. He begs them for help and to believe he is innocent, but Qi Fang is eventually convinced by Wan Gui that he is indeed guilty. Wan Gui, the true culprit behind his imprisonment, is driven by jealousy toward Di Yun and Qi Fang’s relationship, and he orchestrates a cruel scheme: he renders his unconscious body into the bed of their master’s wife, paying to have Di Yun blamed for the crime. Believing Di Yun is guilty, Qi Fang abandons him and later marries Wan Gui. Months pass, and Di Yun learns that even his master has seemingly left him to his fate. Devastated, he attempts suicide but is saved by Ding Dian, who warns him of impending danger and implies he has chosen to be incarcerated out of his own volition.
Several martial artists later visit Ling Tuisi's courthouse, declaring that they have committed various crimes and demanding that he jail them, shocking the magistrates. Ling orders them placed in the same cell as Ding, hoping this will lead him to something known as the Liancheng manual, the very item the martial artists are after. Ding refuses to hand it over and kills all but one of the intruders. Impressed by Ding's martial arts prowess, Di Yun begs to be taught by him, and the latter agrees, revealing himself to be a patient and formidable mentor. The young student shows rapid progress, blossoming into a capable fighter under Ding's tutelage.
Ling later threatens his daughter and Ding's betrothed, Shuanghua Shih Szu, forcing her into a marriage with another man unless she reveals the manual’s whereabouts; devastated, she mutilates her face and reluctantly accedes to the marriage. Ding slips out to meet her in secret, whereupon a tearful Shuanghua reveals her father's ploy and hopes that when she and Ding die, they may be buried together. He shares the secret of the Liancheng manual with her, and she promises to leave a pot of flowers on her windowsill daily so that he can see them from his cell. Her father learns of the secret meeting and again pressures Shuanghua to disclose the manual’s location. When she again refuses, he locks her in a coffin where she slowly suffocates to death. As days pass, the flowers on her windowsill have not been changed. Ding and Di Yun break out to search for Shuanghua and discover her coffin and a funeral tablet. Grief-stricken, Ding mourns beside the coffin, while Ling Tuisi arrives, claiming she died of illness and demanding the manual. Ding refuses, yet realizes his palms have turned black. Ling admits to coating Shuanghua’s coffin lid with a deadly poison and offers an antidote in exchange for the manual, a deceitful ploy Ding quickly discerns by noting the flower used has no true cure. A furious fight erupts, and the two men collapse, with Ding barely escaping.
Ding then reveals a shocking truth: the Liancheng manual once belonged to Mei Niansheng, connected to Qi Zhangfa and Wan Zhenshan; Mei Niansheng was rescued by Ding after being betrayed and mortally wounded by his three disciples. The secret was passed to Ding, who suspects Qi Zhangfa and the Wan family conspired to imprison Di Yun so that Ding could extract the manual’s knowledge—rumored to lead to a great hoard of treasure left by Emperor Wu of Liang. He also explains how he came to be imprisoned: while courting Shuanghua, her father learned of his identity and poisoned him with a flower, torturing him ever since. Ding attempts to relay the manual’s contents to Di Yun, but Di Yun refuses to listen and runs away, eventually running into his master Yan Daping Wai Wang and Wan Zhenshan Walter Tso Tat-Wah, who try to kill him. Ling Tuisi also arrives, and a fierce battle unfolds over Ding; Ding dies in the clash.
With Ding dead, Di Yun buries his mentor and, at Ling Tuisi’s arrival, confronts the wreckage of his own quest. The fight leads to a discovery: Shuanghua’s coffin lid, stained with blood, reveals the treasure’s location inside a Buddha statue in the Tian Ning Temple. When the treasure is brought forth, it is revealed to be poisoned, causing anyone who touches it to bleed from their orifices. The scene erupts into a brutal mob frenzy, and Di Yun watches as the temple becomes a bloody battleground. He single-handedly eliminates Ling Tuisi, Wan Gui, and Yan Daping, though Qi Fang dies after a fatal exchange when Yan Daping is accidentally driven to stab Qi Fang by a last, desperate action. In the end, Di Yun stands as the sole survivor, sets fire to the temple, and pays tribute to Ding by erecting a gravestone before quietly departing.