When the dowager queen of Delain chokes on a lemon and dies, her son (the middle-aged King Roland) must choose a wife and produce an heir. Although Roland isn't attracted to women, he marries Sasha, a 17-year-old girl of noble blood who knows even less about making babies than he does. She becomes a compassionate queen and is loved by all. Roland also grows to love her, but he never learns to like sex — except on one occasion, the day he slays a dragon with a single arrow. Upon returning to the castle, Roland regales his young wife with the details of his heroism. That night, his son Peter is conceived.
Roland's second son might never have been born if it weren't for the misdeeds of Flagg, an evil magician who also serves as Roland's closest adviser. Four years after Peter's birth, Flagg brews Roland a double dose of a special potion that Roland is accustomed to taking on the rare nights he visits Sasha's bedroom. Filled with lustful desire, Roland hurts Sasha and finally collapses in a drunken stupor. Nine months later, Sasha gives birth to Thomas. But before her son is an hour old, Sasha is murdered — the attending midwife kills her on Flagg's orders. Everyone in the kingdom believes she died in childbirth. Peter's two most vivid memories of his mother are of the intricate dollhouse the king commissioned to be built for her when she first arrived in Delain and the night she reminded him to use his napkin. To honor her memory, he uses a napkin at every meal and continues to play with the dollhouse.
Although they grow up together, Peter and Thomas are different. Peter is blessed with both looks and intelligence, and Thomas has neither. To make matters worse, Peter is Roland's obvious favorite. Nevertheless, Peter's character remains unsullied by life's gifts. He saves a horse from certain death. He makes friends with Ben, a lowly squire's son. The citizens of Delain look forward to the day Peter will be their leader.
Thomas, however, internalizes his father's rejection and takes it out on anyone and anything he can. He repeatedly rejects Peter's offers of friendship. He throws a rock at an old, crippled dog — and then keeps throwing rocks until he finally stones it to death. Flagg takes advantage of Thomas' loneliness and shows him things on the castle grounds that will intrigue him and make him fear the magician more than he already does. One of those things is a secret passageway that allows Thomas to spy on his father through the tinted glass eyes of Niner, the dragon that Roland killed and now has mounted on the wall of his study. Thomas grows accustomed to watching his father, often drunk, talking to the mounted heads on his wall, picking his nose and urinating into the fireplace. Thomas soon learns to despise his father. Peter, on the other hand, brings a single glass of wine to Roland every night as a gesture of love and respect.
As the King grows older, Flagg grows increasingly nervous. He is afraid of Peter. Thomas is more malleable, and Flagg has long decided that Thomas should be king instead of Peter. One night, after Peter takes his nightly glass of wine to Roland, Flagg secretly brings him one as well — but Flagg's glass has been spiked with dragon sand, a deadly green poison that burns the victim alive from the inside out. (Flagg doesn't know that Thomas was watching from the secret passage through the glass eyes of the dragon.) Roland, drunk as usual, swills the wine. He dies a gruesome death within the week, smoldering under his sheets while servants throw water on him until a green flame shoots out of his mouth and he stops breathing. Thomas is crowned king, and Peter is tried, found guilty and imprisoned at the top of the Needle, an impregnable fortress that towers 300 feet above the town plaza.
Thomas' rule as king is in name only. While Thomas drinks his way through guilty days and sleepless nights, Flagg taxes the kingdom to ruin and despair. Rebels gather in the outskirts of Delain. But Peter, high above Delain in the Needle, spends every waking moment weaving a rope on the miniature loom in Sasha's old dollhouse using threads he plucks from the napkins that arrive with every meal. He plans to escape, because hidden beneath the flagstones of his cell, he finds an old locket and a letter (written in blood) that proclaimed Flagg as the murderer of a crime committed centuries before — evidence enough to unmask Flagg for the evil magician and murderer that he is.
Flagg goes in search of the rebels, and Thomas begins to sleepwalk. Dennis, the butler's son who now serves Thomas as he once did Peter, follows Thomas to the secret passageway. There Thomas raves against Flagg, and now Dennis also knows the identity of the true murderer. He takes the information to Peyna, the judge who first believed Peter to be guilty of regicide. Peyna is bankrupt under Flagg's harsh regime.
Peyna, acting on intuition, sends Dennis back to the castle with a note to be smuggled to Peter among the napkins. Peter responds by dropping a note (written in his own blood, on the back of the letter that proclaimed Flagg's guilt). Peter writes that he will try to escape the following night, but his rope may break and will be about 20 feet too short.
Ben (the squire's son whom Peter befriended in his youth) and Naomi (a farmer's daughter who is sympathetic to the rebel cause) enter the castle through the sewers and meet Dennis in a room filled with nothing but hundreds of thousands of napkins. A blizzard drops five feet of snow on Delain that night. Feeling that something is afoot, Flagg gazes into his crystal only to see Peter climbing down the outside of the Needle held only by a thin rope. Flagg grabs an ax, kills the guard and races up the stairs to Peter's cell. Peter has already climbed out the window and hangs 100 feet above the ground. His hands are frozen, and the napkin-rope breaks. But instead of falling on the hard stones of the plaza, he falls into a cart that Ben, Dennis and Naomi have piled high with old napkins.
Flagg is furious and chases after the foursome who head for Roland's apartments. Thomas is already there, waiting in the shadows with Roland's old bow and the arrow that he used to slay Niner. When Flagg raises his ax, Thomas shoots him through the left eye. Flagg, shrieking in pain, disappears into thin air, leaving only his clothes behind.
Thomas asks for Peter's forgiveness, which Peter is happy to give. Peter is exonerated and claims his place as rightful king, and Thomas goes on a quest to find and kill Flagg. Dennis continues to serve as Peter's butler, and Ben and Naomi get married.