The novel is set in the island kingdom of Corenwald, a nation founded by refugees who fled the tyranny of the Pyrthen Empire. Twelve-year-old Aidan Errolson, the youngest of five sons of Errol, a nobleman on Corenwald's eastern frontier, dreams of adventure while tending sheep on the family estate, Longleaf Manor. He has written 15 unanswered letters to King Darrow volunteering as a knight-errant, but his life remains quiet.
One afternoon, while singing a boastful marching song in the pasture, Aidan hears the bark of the bog owl, a rare call from the deep wilderness, and his adventurous spirit ignites. When he tries to pole-vault a creek and crashes into the mud, he hears giggling from a beech tree. A terrifying creature drops from the branches, apparently a scaly, tailed monster. Aidan realizes it is a boy dressed in an alligator-hide tunic and a snapping-turtle-shell helmet: one of the feechiefolk, a wild, nomadic tribe that most civilized Corenwalders consider mythical. The feechie boy, Dobro Turtlebane, insists on fighting, but when Aidan admits his toughness was make-believe, Dobro cries, confessing he is lonely. Aidan challenges Dobro to wrestle. During their match, a real panther stalks the sheep. Dobro charges it recklessly with Aidan's staff, and when the enraged cat chases him back, Aidan kills it with a single sling stone. A servant summons Aidan home, and Dobro vanishes.
At the manor house, Aidan's father has received Bayard the Truthspeaker, Corenwald's greatest prophet, unseen for 20 years. Bayard has examined Aidan's four older brothers and declared that none is the Wilderking, a figure from an ancient prophecy who will arise from the wilderness to restore Corenwald when the nation loses its way. When Aidan enters the great hall battered and muddy, Bayard declares, "Hail to the Wilderking!" His brothers laugh. Alone with Aidan, Bayard insists he is the Wilderking and counsels him to "live the life that unfolds before you" and to "love goodness more than you fear evil." Weeks pass with no sign of Dobro or the panther's body, and doubt settles over Aidan. He feels that dwelling on the prophecy makes him a traitor to King Darrow, yet he spends his free time exploring the forests, unknowingly perfecting wilderness skills.
When Aidan discovers an enormous bull alligator near the river, he captures it single-handedly as a gift for King Darrow, hoping to demonstrate his loyalty and quiet his doubts about the prophecy. With his brothers' help, the alligator, named Samson, is loaded onto a cart. Errol announces that the family has been invited to a treaty feast at Tambluff Castle, where Darrow will celebrate a new alliance with the Pyrthen Empire. Errol warns that the Pyrthens, who have invaded Corenwald four times before, love only power.
At the feast, Darrow unveils Samson painted gold as a symbol of "The Wilderness Improved," but the drugged alligator is a pitiable spectacle. A junior Pyrthen diplomat then announces that the Senate has voted to annex Corenwald, that warships are landing on the western coast, and that an army will occupy the Bonifay Plain. Errol slams the table and shouts "Never!" delivering an impassioned speech about Corenwald's dream of freedom. Darrow orders the army mobilized, but Errol immediately collapses from a stroke.
While Errol recovers, his four eldest sons march to the Bonifay Plain. Aidan stays behind until Errol sends him with provisions for his brothers. Taking a shortcut through the wilderness, Aidan is captured by feechie scouts and brought before over a hundred feechiefolk at the band's Meeting Hummock. Dobro, hiding in the crowd, is exposed when the feechies realize Aidan was calling his name. Dobro's mother, Luku Turtlebane, learns Aidan saved her son and cuts his bonds. Chief Gergo Snagroot declares Aidan a "feechiefriend" and hosts a feast where Aidan receives the feechie name Pantherbane, a panther-hide cape, and a brand on his forearm shaped like an alligator. The feechies pledge that his fights are theirs. Before parting, Dobro mentions a feechie prophecy about a civilizer king who will unite feechie and civilizer Corenwald into one nation.
Aidan arrives at the Corenwalder battle camp to find it demoralized. For two weeks, the Pyrthen champion Greidawl, a seven-foot giant in iron armor, has challenged Corenwald to send a champion for single combat, and no one has dared face him. When Aidan learns that Darrow has tried to surrender but the Pyrthens insist on either single combat or a pitched battle within three days, he volunteers to fight. In the council tent, where Bayard now sits at Darrow's right hand, the king is incredulous, but Aidan argues that since no champion exists and surrender has failed, letting him fight risks nothing. The War Council agrees. Offered armor from the royal armory, Aidan tries on a suit far too large and causes comic havoc, losing his grip on a flail that topples shields, spears, and a table of swords. He tells Darrow he will fight in his shepherd's clothes with his sling, declaring that only a miracle of the One God can deliver them and that everyone must know the true Champion is God.
At noon, Aidan descends into the valley armed only with his sling. Greidawl hurls his massive spear, which misses by inches. As the giant charges with his battle-ax, Aidan whirls his sling and releases a stone that embeds in Greidawl's forehead. The giant staggers and collapses. Aidan drags the enormous ax to Greidawl and, with a feechie battle cry, delivers the killing blow. He lifts the giant's helmet and shouts to his countrymen: "Remember! Remember!" The army's courage is restored.
Pyrthen archers fire on Aidan, and a full battle erupts. The Corenwalders push the Pyrthens back but cannot overrun their camp, especially after the Pyrthens unleash cannons, called "thunder-tubes," that fire iron balls across the valley. An old farmer-soldier reveals that limestone caves may connect the two sides of the valley underground, and Darrow orders a scouting team of miners to explore the passage. Aidan volunteers, arguing his small size will help in tight spaces.
The team, led by the foreman Gustus and guided by Arliss, a teenager with an inherited ability to navigate underground, descends into vast limestone chambers and an underground lake. After harrowing stretches of swimming through total darkness, they confirm the passage leads beneath the Pyrthen camp. Only Aidan and the slender Arliss can squeeze through a final narrow crevice. Despite orders to turn back, they press ahead, reasoning that another day of cannon fire may leave no tomorrow for Corenwald. They discover barrels of "flame powder," the explosive substance fueling the cannons, stored in a cave open to the sky. When the thunder-tubes resume firing, the boys pour a trail of powder from the barrels to the underground pool, ignite it, and plunge into the water. The barrels detonate, devastating the Pyrthen camp.
Darrow leads a charge across the valley, putting the Pyrthens to flight. When the fleeing soldiers enter the Eechihoolee Forest, they come running back in terror, surrendering and babbling about "gray people" attacking from the treetops. Aidan recognizes these as the feechiefolk, honoring their pledge. The fifth Pyrthen invasion of Corenwald ends in defeat.
In the epilogue, Aidan is back tending sheep when Darrow and Errol arrive with Samson, the gold paint mostly worn off, to release the alligator into the river. Darrow tells Aidan he belongs to Corenwald now and invites him to live at Tambluff Castle, studying the arts of government alongside Prince Steren, Darrow's heir. Errol gives his blessing, and Aidan accepts joyfully.