During the Qing dynasty, the young Shaolin disciple Fong Sai-yuk and his master Chi Nun are fleeing Manchu government agents who have orders to destroy the Shaolin Monastery for plotting to overthrow the government. While on the run, they meet Tou Tou, a streetwise prostitute who helps them hide. However, they are soon discovered by the merciless Manchu officer Crimson, who kills Chi Nun and captures Fong and Tou Tou.
Fong and Tou Tou end up imprisoned at Red Lotus Temple, where other Shaolin practitioners are held captive. The prison’s warden, Kung, is a hedonistic, power-hungry former general who forces the inmates to work as slave labor and booby-traps the entire building to punish dissidents. He has enlisted one of their own, Hung Hei-gun, as the foreman. A brutal clash erupts when Kung’s spear wounds Fong, leaving him to die in a pit full of corpses, where he meets Shaolin master Chi Seen.
Meanwhile, Tou Tou becomes Kung’s concubine. When she offers a trade for Fong’s release—her servitude in exchange for his freedom—Kung initially agrees, but jealousy soon makes him renege and throw Fong back into the jail. A rapid love triangle forms around head priestess Brooke and Hung, with a tangled dynamic also involving priestess Luk. Hung is briefly caught by Brooke for looking at an explosives stash, yet she lets him go; Luk betrays Hung, using his freedom as foreman to map a route through the temple for the inmates. The ruse is uncovered, and Hung helps Fong free the prisoners, who avenge Luk by killing her.
The Shaolin prisoners and the Manchu soldiers clash, and the soldiers manage to trap the disciples between gates. Fong and Hung slip away from the soldiers, and Hung reveals a plan to free everyone by blowing up the traps from a weapons storehouse. The two locate Tou Tou in Kung’s bedroom, but Brooke intervenes and fights them both. She’s defeated when a broken bedframe crashes onto her leg, triggering a bed-triggered trap that releases poisonous gas. Hung saves Brooke by carrying her out of the room just before the gas takes hold.
Fong and Tou Tou press on through a catacomb of dead concubines. Meanwhile, Hung and a wounded Brooke hustle toward the explosives, though a trap ends Brooke’s life. Crimson enters the catacombs and engages Fong in battle. Hung’s countdown to detonation erupts, sending the temple into chaos and forcing the soldiers to flee. Fong and Crimson resume their duel in the main forge area, where Crimson is finally impaled by Fong’s thrown sword and the explosion that follows.
As Kung’s true prowess is revealed—he reveals himself as a formidable martial artist who even uses inked paper as deadly projectiles—Chi Seen, Hung, and the remaining Shaolin members try to escape. They reach a Buddha statue which proves booby-trapped with firearms; the disciples’ kowtowing opens a hidden chamber, and they widen the hole by lighting gunpowder near the statue. In the finale, Kung taunts them from the arena; Fong briefly blinds Kung with his own ink, and the two ultimately kill Kung by using chained restraints. With the temple collapsing around them, the survivors reunite, and Fong begins to escort Tou Tou home on horseback, the danger finally behind them.