The story follows a plot by a secret brotherhood, the Unique and Supreme Lodge of the Elucidated Brethren of the Ebon Night, to overthrow the Patrician of Ankh-Morpork and install a puppet king, under the control of the Supreme Grand Master (Vetinari's secretary, Lupine Wonse). Using a stolen magic book, they summon a dragon to strike fear into the people of Ankh-Morpork.
Once a suitable state of terror and panic has been created, the Supreme Grand Master proposes to put forth an "heir" to the throne, who will slay the dragon and rid the city of tyranny. It is the task of the Night Watch – Captain Vimes, Sergeant Colon, Corporal Nobbs, and new volunteer Carrot Ironfoundersson – to stop them, with some help from the Librarian of the Unseen University, an orangutan trying to get the stolen book back.
The Watch is in bad condition; they are regarded as a bunch of incompetents who just walk around ringing their bells, and this is mostly true. The arrival of Carrot changes this; Carrot has memorised the Laws and Ordinances of the Cities of Ankh and Morpork, and on his first day tries to arrest the head of the Thieves' Guild for theft (the Thieves' Guild is permitted a quota of legally licensed thieving, a concept that the book of ancient Laws does not take into account). Carrot's enthusiasm strikes a chord with Vimes; the Watch should prevent crime, not ignore it. Vimes begins investigating the dragon's appearances, which leads to an acquaintance with Sybil Ramkin, a breeder of swamp dragons. Ramkin gives an underdeveloped dragon, Errol, to the Watch as a mascot.
The leader of the Elucidated Brethren is initially successful in controlling the dragon, but he has not accounted for the dragon's own abilities. The banished dragon returns, and makes itself king of Ankh-Morpork (keeping the head of the Elucidated Brethren as its mouthpiece) and demands that the people of Ankh-Morpork bring it gold and regular virgin sacrifices.
Shortly after, Vimes is imprisoned in the same cell as the Patrician, who has been leading a relatively comfortable life with the help of the rats he uses as spies. The Librarian helps Vimes to escape and he runs to the aid of Sybil, who has been chosen as the first virgin to be sacrificed. The Watch's swamp dragon, Errol, reorganises his digestive system to form a supersonic jet engine and fights the king, eventually knocking the king out of the sky with a shock wave. As the assembled crowd closes in on the king for the kill, Sybil tries to plead for its life. Carrot instead places it under arrest, however Errol lets the dragon escape, revealing that the dragon is in fact female, the battle between the two in fact being a courtship ritual.
Sam Vimes proceeds to arrest Lupine Wonse, but accidentally causes the man's death when he told Carrot to "throw the book at him." The man was attempting to summon another dragon, and died from falling off a broken floor after being hit by the Laws and Ordinances of Ankh-Morpork.
The Patrician is reinstated as ruler of Ankh-Morpork, and offers the Watch anything they want as a reward. They ask only for a modest pay raise, a new tea kettle and a dartboard.