The story is set in Castellane, a prosperous port city-state in the fantasy world of Dannemore, where 12 noble Charter Families control trade under the authority of House Aurelian, the royal family. Centuries before, a cataclysm called the Sundering destroyed nearly all magic, save for
gematry, an ancestral art of combining letters and numbers into talismans, practiced only by the Ashkar, a displaced people required by law to live within a walled enclave called the Sault.
Ten-year-old Kel is taken from an orphanage by Legate Aristide Jolivet, captain of the King's elite Arrow Squadron, and brought to the Palace of Marivent on the Hill, the elevated district where the nobility resides. The King's Ashkari Counselor, Mayesh Bensimon, explains that Kel must impersonate Crown Prince Conor Aurelian at a state dinner. Fitted with an Ashkari talisman that makes him appear to be Conor, Kel succeeds. Afterward, Conor reveals himself and explains the Malgasi tradition of the Királar, or Sword Catcher: a body double trained to look and act like the prince, standing between him and danger. Moved by Conor's vulnerability, Kel agrees.
Thirteen years later, Kel and Conor are 23. Conor faces pressure to marry for political alliance but dismisses every candidate, while Kel regularly stands in for him at public events. The narrative's other thread follows Lin Caster, Mayesh's granddaughter and the first female physician in the Sault. Lin's closest friend, Mariam Duhary, a Malgasi refugee, has a progressive, incurable illness that drives Lin's desperate search for new treatments. Lin resents Mayesh deeply: After her parents were killed by bandits, he refused to raise her and her brother Josit, prioritizing his Palace duties. Conor's social circle includes Antonetta Alleyne, a Charter Family daughter and Kel's childhood friend whose mother has forced her into performing as a vapid society girl.
Kel secretly buys a poison antidote from Merren Asper, a student of poisons. Leaving the meeting, he is kidnapped by the Ragpicker King, Castellane's most powerful criminal, whose real name is Andreyen Morettus. Andreyen reveals he knows Kel is the Sword Catcher and offers him a job spying on the nobles of the Hill. Kel refuses. That same night, Conor drunkenly confesses he has made terrible mistakes but will not elaborate.
Walking home in Conor's distinctive cloak, Kel is ambushed by Crawlers, skilled thieves who work for Prosper Beck. Beck is a rising criminal who controls the Maze, Castellane's lawless district. The Crawlers mistake Kel for Conor and demand repayment of 10,000 crowns in debts Beck has legally purchased. When they realize Kel is not the Prince, one stabs him. Ji-An, Andreyen's assassin, kills several attackers and carries Kel's body to the Palace gates.
Mayesh summons Lin to save Kel. She performs emergency surgery, draining blood that is crushing his heart and lungs. She saves his life but refuses Conor's signet ring as payment, enraging the Prince, who forbids her from returning to Marivent. Lin recognizes Kel's talisman as ancient Ashkari illusion magic and deduces he is the Sword Catcher. Mayesh confirms this and swears her to secrecy.
An elderly patient, Anton Petrov, secretly slips a smooth gray stone into Lin's satchel before vanishing; his landlady reports that men came for him and he is likely dead. The Ragpicker King identifies the stone as a Source-Stone, an artifact from before the Sundering that once allowed magicians to store magical energy. He offers Lin access to his laboratory and help finding the lost works of Qasmuna, an ancient scholar-physician, in exchange for Lin learning to use the stone for healing.
Kel confronts Conor about the debt to Beck. Conor admits that Beck bought up all his debts and now demands full repayment. Alarmed by the mounting threats to Conor's safety, Kel begins working covertly with the Ragpicker King. Disguised as Conor, he visits King Markus in the Star Tower, where the King has retreated with his astronomer Fausten, obsessed with the stars since a mental health crisis years earlier. Markus speaks cryptically of a debt "of blood and flesh" and danger to Conor, but Fausten interrupts before more can be learned. Andreyen reveals that an ancient secret contract between the King and the Ragpicker King to maintain order in Castellane has been severed because their go-between was murdered.
At a state dinner, the Malgasi Ambassador Sarany reveals that Markus promised decades ago to wed Conor to a Malgasi princess, with Fausten secretly manipulating the King at Malgasi's direction. Conor stuns the room by announcing he has already engaged himself to Princess Aimada of Sarthe, using the Sarthian dowry to repay Beck. The King, enraged at Fausten's betrayal and Conor's unauthorized actions, sends Fausten to the Trick, the Palace's prison tower, and orders Jolivet to whip Conor until he loses consciousness. Queen Lilibet secretly summons Lin to heal Conor. The Source-Stone pulses with heat as Lin tends his wounds, and she visualizes the Ashkari word for "heal"; by morning, every wound has vanished. The three agree to keep this secret. Kel later witnesses Markus execute Fausten by throwing him from a hidden platform into the sea to be devoured by crocodiles.
Sarthe retaliates by sending not the expected bride but her 12-year-old sister Luisa, exploiting a technicality in the marriage contract. At a party, Lin intervenes when Charlon Roverge, a Charter Family heir, forces Luisa to dance for the crowd, performing the sacred Goddess Dance of the Ashkar in the child's place. Conor dismisses her performance, then privately confesses his anger stems from her wanting nothing from him. He kisses her; she responds before pulling away. Meanwhile, Kel steals Antonetta's gold locket at Beck's demand but finds it contains only a dried grass ring he gave her when they were 15. Beck flees Castellane, leaving behind a cryptic warning of coming danger. Conor delivers Qasmuna's book to Lin, but the Maharam, Davit Benezar, the Sault's religious leader, confiscates it along with all her books.
On Ascension Day, the threads converge at the royal welcoming banquet for Princess Luisa. Conor, overwhelmed by despair, abandons the feast, forcing Kel to impersonate him. Conor returns drunk and remorseful, and the two begin switching clothes when armed attackers in skull-painted faces storm the Shining Gallery. A crossbow bolt kills Princess Luisa. Vienne d'Este, Luisa's bodyguard from the elite Sarthian Black Guard, slaughters every remaining attacker, then turns her sword on Conor. King Markus appears, catches her blade bare-handed, and kills her. An elderly nobleman, Gremont, dies in Kel's arms, whispering a warning to trust no one on the Hill and beware the "Gray Serpent." A faceless assassin tells Kel this is the beginning of the fall of House Aurelian.
Simultaneously, Lin enacts a desperate gamble at the Goddess Festival in the Sault. When the Maharam asks the ritual question, "Are you the Goddess Reborn?", Lin answers yes. At midnight, explosives destroy six Roverge ships in the harbor, creating a fire that appears to confirm her claim. The Ashkar kneel before her, and the Maharam leads her to the Shulamat, the sacred library where Lin will finally access the texts she needs.
Jolivet intercepts Kel and reveals he has known about Kel's contact with the Ragpicker King all along. Rather than punishing him, Jolivet endorses the alliance: Someone on the Hill helped the attackers breach Marivent, and Kel is uniquely positioned to discover who. Kel goes to the Ragpicker King's headquarters and tells Andreyen he will work with him, not for him. Conor, shattered by the attack, commits to active governance for the first time and tells Kel he trusts no one else. Kel, keeping his alliances secret, reflects that he is lying to the person he loves most, telling himself the Prince will one day know the truth and forgive him.