In an ancient castle on the side of a mountain on the planet Peladon, Chancellor Torbis informs the young King Peladon that the Galactic Federation delegate from Alpha Centauri has arrived and will be presenting its credentials shortly. Peladon is on the verge of joining the Federation, and the delegates will discuss and make the final decision. However, High Priest Hepesh is opposed to the planet joining the Federation, warning that the curse of Aggedor — the Royal Beast of Peladon, whose spirit is worshipped by the people — will visit doom upon them all if they give up the old ways. Torbis argues that they should go ahead with the application. Peladon halts his arguments of his trusted advisors and tells Torbis to inform the other delegates that Alpha Centauri has arrived. Torbis leaves, but he is killed in the corridor by a large, ferocious beast that vanishes as quickly as it appears, witnessed only by Grun, the mute King's Champion.
Below the castle, the TARDIS materialises on the edge of a cliff. Inside, Jo complains to the Doctor that the test flight of the TARDIS was supposed only to take a few minutes but has lasted much longer — she was dressed up and ready to go on a date with Captain Mike Yates. When the Doctor opens the doors of the TARDIS, however, he finds that they have not returned to Earth. Jo barely makes it out of the TARDIS before the ship tumbles over the edge of the cliff to the rocks below. The Doctor reassures Jo that the TARDIS is indestructible, but they will need help to retrieve her. He spies the castle above and they start to make the climb.
Meanwhile, Alpha Centauri, a hermaphroditic hexapod with one gigantic eye, presents itself in the throne room, where Peladon informs it of Torbis's death. This news agitates the highly excitable alien, who wants to cancel the conference. Peladon manages to persuade Alpha Centauri that it is safe, and Hepesh escorts it to see the other delegates. On the side of the mountain, the Doctor and Jo find an entrance which leads to a network of tunnels beneath the castle. Wandering through the tunnels, they hear the distant roar of an animal, and a shrine containing the statue of a giant, fur-covered creature with a single horn and wicked looking claws.
Alpha Centauri meets the delegate from Arcturus, a tentacled head in a glass dome mounted on a mechanised life support box that allows it to breathe in Peladon's atmosphere. When told of the potential danger, Arcturus warns Hepesh that although the Federation eschews violence, they are capable of using it in self-defence. To demonstrate, Arcturus destroys a vase with an energy weapon mounted on its box. Hepesh says that Peladon only desires their friendship, and returns to the King. Peladon reminds Hepesh that when his father died, the boy king refused to take the throne but Torbis and Hepesh convinced him to, and his mother, an Earth woman, allowed it. It was Torbis's dream for their Planet to join the Federation, and Peladon asks for Hepesh's support to fulfil it, but Hepesh says he will not trust the aliens. Peladon asks for the delegates to be brought to him, so he can convince them that his people are not the primitives the Federation think they are.
The Doctor and Jo find a concealed way out of the tunnels, activated by pulling a mounted torch on the wall. Once through into the corridors of the castle, however, the Doctor spots a familiar, hulking shape — an Ice Warrior, and ducks back to hide. The two are discovered by the palace guards, who take them to the throne room, where the other delegates are gathered: Alpha Centauri, Arcturus, the Ice Lord Izlyr and the Ice Warrior Ssorg. The delegates had been discussing the curse, based on Aggedor. Young men used to hunt the Royal Beast in the old days, and the legend has passed down through the centuries. Its fur trims the royal robes and its head is Peladon's emblem. The prophecy says that when Aggedor's spirit returns, a stranger would also appear that would bring great tribulation to the planet. As this is said, the Doctor and Jo are brought before the King. Izlyr mistakes the Doctor for the delegate from Earth, and the Doctor does not disabuse him of the notion. The Doctor claims that his "shuttle" crashed, and his credentials lost as a result. He asks for help in recovering his ship, and Hepesh says that it will be arranged. When Hepesh points out Jo, saying that only men of rank or noble personages are allowed in the throne room, the Doctor introduces Jo as the "Princess Josephine of TARDIS", a neutral royal observer from Earth. The young King seems quite taken with Jo.
As the assembly brings the Doctor up to date on what has transpired, Grun surreptitiously starts to loosen a heavy statue of Aggedor placed above the corridor outside the throne room. When the Doctor is taken to the conference room to debate further, the statue topples over...
The Doctor manages to push Alpha Centauri and the Ice Warriors ahead of him, saving their lives. Arcturus and Jo were lagging behind. Grun gets away unnoticed as the delegates discuss once more if the conference should continue. Hepesh blames the ghost of Aggedor, but Peladon reminds him who is King. Jo, at a nod from the Doctor, finds her way to the ledge where the statue once stood, and finds a small electronic component there.
Peladon tries to assure the delegates that there is no plot to endanger them or keep them as hostages. The Doctor takes them away, but Peladon asks Jo to stay behind. He tells Jo that it is difficult to find someone he can confide in. He tells Jo that his mother was from Earth, so there is already a bond between Jo and himself. Peladon asks her to believe him, holding her hand, and she replies that she does. He then asks Jo to speak to the delegates on his behalf. Jo is hurt by the request, accuses Peladon of only wanting a political ally and leaves. In another part of the castle, Hepesh tells Grun that the failure of the sabotage with the statue was not his fault, merely Aggedor's mercy. Hepesh prays to Aggedor and tells Grun to destroy the Doctor.
The Doctor examines the component Jo found, and identifies it as an electronic key, possibly for a spaceship. It made of trisilicate, which is only found on Mars, the homeworld of the Ice Warriors. His previous experience with the Ice Warriors makes him suspect that they are behind the sabotage — Ssorg's strength could have easily shifted the statue. The Doctor cannot explain, however, how Ssorg managed to slip away during the debate. At that moment, an alarm sounds, and rushing to investigate, the Doctor and Jo find Arcturus, his box smoking. Someone has removed the servo mechanism to his life support system, and while the Doctor tries to repair the damage, Jo goes to look for the missing mechanism in the delegates' quarters. Arcturus recovers, but cannot remember who attacked him. Grun comes along and motions for the Doctor to follow him, while Hepesh secretly watches.
Jo finds the mechanism in the Ice Warriors' chamber, but is found by Ssorg before she can leave with it. Ssorg locks her in and goes to tell Izlyr, who is speculating to Alpha Centauri that perhaps the Doctor is responsible; cementing a secret alliance between Earth and Peladon for its mineral deposits by means of a royal marriage between the King and "Princess Josephine". His suspicions appear confirmed when Ssorg tells him that the missing mechanism has been found with the "Princess". Jo, in the meantime, has climbed out a window and is working her way along a ledge. She moves back into the corridors, and is frightened when she sees the Aggedor beast and runs straight into Izlyr and Ssorg.
Grun, in the meantime, has led the Doctor to a secret passage to the tunnels, but runs away when they hear the roars of the beast, which starts to pursue the Doctor. The beast having now vanished from the corridors, Izlyr does not believe Jo when she says she saw it. Jo accuses Izlyr of the sabotage, but Izlyr points out that removing the mechanism would only have induced a metabolic coma in Arcturus, not kill him. He explains to Jo that the Ice Warriors were a warrior race once, but no longer believe in violence except in self-defence. After all, to have peace, it is necessary first to survive.
The Doctor finds another way out of the tunnels, into the room which holds the shrine of Aggedor. He touches the statue of Aggedor, but is discovered by Hepesh and Grun. They forcibly escort him to the throne room, where Hepesh accuses the Doctor of sacrilege. Peladon, although distressed, has no choice but to sentence the Doctor to death...
Unfortunately, Federation articles state that the delegates cannot interfere with local laws, so they are powerless to intervene. Izlyr suggests a royal pardon, but Peladon cannot pardon sacrilege. However, over Hepesh's protests, the King offers an alternative: as the Doctor is a delegate and thus a man of rank, he can undergo trial by combat—a duel to the death with the King's Champion. The Doctor, now knowing Hepesh is behind it all, is taken away to await the combat at dawn.
When the delegates leave, Jo pleads with Peladon once again to pardon the Doctor, but Peladon maintains it was his duty to sentence the Doctor. Peladon proposes marriage to Jo, who greets the proposal with incredulity. Jo does not understand how Peladon can condemn the Doctor one minute and ask her to marry him the next, and leaves. In the Doctor's cell, Hepesh tells the Doctor that his "shuttle" has been recovered. Hepesh has no wish to see him dead, and offers him an escape route. The Doctor is sceptical, believing Hepesh just wants an excuse to kill him while escaping. Hepesh draws the Doctor a map, and in answer to the Doctor's questions, explains that he believes the Federation will exploit Peladon for its minerals. The Doctor says that joining the Federation will free them from superstition, but Hepesh counters that he is not alone in this.
Jo also tries to convince the delegates to intervene, but although Izlyr agrees that the death of the Doctor (as the delegate from Earth) will mean war, they cannot. Alpha Centauri and Arcturus both want to leave, in case hostilities do break out. Jo leaves in disgust, but Izlyr explains to her in private that all votes must be unanimous by Federation law, and Izlyr has voted to stay and save the Doctor, to repay him for saving his life outside the throne room earlier. However, Arcturus has used a listening device to eavesdrop on the conversation.
In his cell, the Doctor fixes a spinning mirror to his sonic screwdriver and pockets Hepesh's map. He leaves, following the marked route to the tunnels. Izlyr and Ssorg find the Doctor gone, and suspect he has been eliminated. In the tunnels, the Doctor encounters the beast again, and using the mirror as a hypnosis device and singing the strains of a Venutian lullaby, calms "Aggedor" down. However, Jo finds him at this point and uses a torch to frighten the beast away, to the Doctor's frustration.
In the throne room, Hepesh tells the King that the Doctor's absence is proof of guilt, and he will hunt the Doctor down. At this point, the Doctor and Jo appear, and the Doctor tries to tell the King about the reality of Aggedor and how it is being used to sabotage the conference. Hepesh dismisses the talk of secret tunnels as lies, and orders that the Doctor be taken away to face Grun in combat. The fight in the pit starts with spears and ends with hand-to-hand combat, but eventually the Doctor is victorious, and spares Grun's life. Suddenly, Arcturus powers up his energy weapon, preparing to fire...
Ssorg opens fire with his own rifle, killing Arcturus as Hepesh slips away with another guard. The others now realise what is going on. It was Hepesh who was behind the planting of the trisilicate key on the ledge and the placing of Arcturus' servo mechanism in the Ice Warriors' quarters to make it look like the Ice Warriors were behind the plot. The attack on Arcturus was faked, and Aggedor is one of the few remaining wild beasts that were the source of the legend, trained by Hepesh to pose as the "spirit of Aggedor" when Hepesh needed it. As Arcturus and the Ice Warriors are ancient enemies, it would be simple now to accuse the latter of murdering the former's delegate. Hepesh must have made an agreement with Arcturus for Peladon's mineral deposits in exchange for his help, as Arcturus's planet lacks minerals. However, to replace Hepesh might result in civil war. The Federation allows for interference in crisis situations, but Alpha Centauri is still uncertain if this is justifiable.
While the delegates argue, Hepesh is gathering his own forces to take the throne room by force, but reminds them that the King must not be harmed. Grun, who is trying to repay the Doctor for sparing his life, tries to persuade Hepesh from this course of action, but is defeated by Hepesh's men. Eventually, the delegates vote unanimously for intervention, with Alpha Centauri's vote under protest. However, they are unable to communicate this vote to their orbiting ships, as their communicators in their rooms have been smashed by Hepesh and his men. The Doctor finds Grun, and they make their way into the tunnels to find the Aggedor beast. There, the Doctor tames Aggedor again, and leads it away by its horn.
Hepesh's forces have taken the throne room, and hold the King hostage. Hepesh tells the King that he will live, as long as he goes back to the old ways. Hepesh then leaves to fetch the delegates to the throne room. Once gathered, Hepesh tells them to leave the planet and tell their governments that Peladon does not want to be part of the Federation. Suddenly, the Doctor arrives with Aggedor, accusing Hepesh of betraying the King. The guards are awed by the appearance of the legendary beast, but Hepesh denounces it. To prove that it is not the spirit of Aggedor and is it he who controls it, Hepesh orders Aggedor to kill the Doctor. However, the beast turns on Hepesh instead, inflicting a fatal wound before the Doctor manages to call it off. The Chancellor dies in the King's arms, murmuring that he might have been wrong, but that all he wanted to do was save Peladon. The King weeps, but pulls himself together. He pardons the rebel guards, and drapes a cloth to cover Hepesh's face.
As the court prepares for the King's coronation, the Doctor shows Jo where the TARDIS is being kept after its recovery by Hepesh's men. He muses that it was no coincidence that they landed here at this crucial moment in Peladon's history — the Time Lords must have steered the TARDIS here, so the ship is still not within the Doctor's control. Aggedor arrives, having grown attached to the Doctor, and he leads the beast away as Peladon himself comes to speak with Jo. He asks Jo to stay, but she protests she is not even a real princess. This does not matter to him, however, and he will talk to her again after the coronation — he does not propose to give up.
The Doctor returns as Peladon goes to be crowned King. He asks Jo if she really wants to leave, and Jo says sadly that she had better. They will watch the coronation, then quietly make their exit. On their way, however, they nearly stumble on the real delegate from Earth, who is being told by the other delegates what has happened. "What Doctor? Doctor who?" the Earth delegate asks, as the Doctor and Jo decide that it would be best if they left quickly. They rush back to the TARDIS with the delegates following close behind. Before the delegates' amazed eyes, the police box-shaped time machine dematerialises.