As the Earth cargo ship C982 moves through hyperspace, it narrowly avoids a collision with the TARDIS, which dematerialises out of the way and rematerialises in the ship's hold. As the Third Doctor determines that they are in the 26th century, Jo sees a ship come alongside and hears a strange, high-pitched buzz. Before her eyes, the ship shimmers, changing shape, turning into a Draconian Galaxy-class battlecruiser. The two pilots, Stewart and Hardy, send out a distress signal and prepare for battle. When Hardy goes to get weapons, he meets the Doctor, but thanks to the sound emitted by the enemy ship, sees him and Jo as Draconians. Hardy escorts the Doctor and Jo at gunpoint to the ship as the Draconian captain orders C982 to surrender its cargo or be destroyed.
On Earth, the President and the Draconian ambassador (who is also the Emperor's son) accuse each other of attacking the other's ships and violating the frontier established by treaty between the two empires. General Williams reports to the President that a mission to rescue C982 is being prepared. Williams's hostility against the Draconians is well known — it was his actions that started the original war between the two sides and the Prince believes Williams wants war again, a war the Prince warns the President that will see Earth destroyed. News of the attack spreads and anti-Draconian riots break out on Earth, with the opposition calling for the government to take action.
Locked up in C982's hold, the Doctor deduces that the strange sound was some kind of sonic hypnosis device that caused Hardy to hallucinate and see what he most feared. As the enemy boarding party burns its way through the airlocks, Hardy gets the Doctor and Jo to use as hostages, but when the airlock door bursts open, the boarders are not Draconians, but Ogrons. The Ogrons' energy weapons stun the two pilots and the Doctor. They then tie Jo up, taking the ship's cargo and the TARDIS as they leave. When the Doctor revives and releases Jo, she tells him what the Ogrons did, and wonders if they are working for the Daleks, as they were when she first met them. The Doctor points out, however, that the Ogrons are mercenaries.
When the rescue party arrives, Hardy and Stewart have stopped hallucinating, but with their memories garbled, accuse the Doctor and Jo of being Draconian spies...
The two travellers get locked up again as C982 heads back to Earth. General Williams believes the Doctor and Jo are human agents planted by the Draconians to sabotage any war effort by Earth. He brings the two travellers to confront the Draconian Prince, but the Doctor denies working for the Draconians. He tries to convince the President that a third party is trying to provoke the two empires into war. However, as he can provide no reason why someone would want to, Williams orders the Doctor and Jo be taken away and vows he will get the truth out of them.
In the Draconian embassy, the Prince arranges to help Jo and the Doctor "escape" so that they can be questioned. When the two are escorted from their cell to be brought to the President, a Draconian squad attacks, taking the Doctor prisoner. When Jo tries to get more guards to help, she is arrested instead. The Draconians question the Doctor, believing that he is involved in a plot with Williams to provoke a new war. The Doctor manages to escape the embassy, but is recaptured in the compound by Earth troops. Once back in the cell with Jo, however, she hears the same sound as on C982. Outside, the Ogrons raid the prison, being seen as Draconians thanks to the hypnosound. They break into the Doctor's cell and order him to go with them.
The second escape goes no better than the first: the Doctor is recaptured yet again and the Ogrons disappear. This second "rescue attempt" cements Williams' suspicions, making him demand that the President give him the authority to strike first against the Draconians. The President agrees to break off diplomatic relations but will not go further without conclusive proof.
Williams places the Doctor under a mind probe, but it indicates the Doctor is telling the truth. Refusing to believe it, Williams orders increased power, but eventually the probe overloads. The President orders that the Doctor be sent to the Lunar Penal Colony where political prisoners are exiled for life, while Jo remains on Earth. Williams and the President receive records from the Dominion government of Sirius IV, an Earth colony planet that has achieved a degree of autonomy from Earth. The records "prove" the Doctor and Jo are citizens of Sirius IV as well as career criminals. A commissioner from the Dominion has arrived to claim jurisdiction — who is in actuality the Doctor's old enemy, the Master.
On the Moon, the Doctor meets Professor Dale of the Peace Party, who shows him around. The Doctor tries to get Dale to trust him and include him in his plans for escape. On Earth, Jo of course recognises the Master immediately, and surmises correctly that he was behind the Ogron attacks. The Master found out about the Doctor and Jo's presence when the Ogrons brought him the TARDIS. Given the unsavoury choice of going with the Master or staying in her cell, Jo agrees to go with him to fetch the Doctor.
Despite his fantastic story, Dale believes the Doctor. The peace with the Draconians lasted many years, but suddenly devolved into senseless acts of hostility. The Doctor's story would explain a great deal. Dale outlines the escape plan: Cross, one of the overseers, will leave two spacesuits near an airlock, and they will walk across the lunar surface to steal a spaceship. Dale offers to take the Doctor back to Earth where he can tell his story to Dale's contacts in the press and government. However, once inside the airlock, they find oxygen tanks for the suits are empty. Cross has double-crossed them, and the room is depressurising.
At the last moment, the Master arrives and restores the room's atmosphere. The Master obtains custody of the Doctor, and gets the Doctor to come along quietly by revealing that he has Jo. Reunited with Jo in a cell in the Master's ship, the Doctor wonders why he is still alive. The Master explains that his employers are very interested in the Doctor. The Master sets the automatic controls for the Ogron homeworld. Under the cover of telling Jo stories of his life, the Doctor uses a hidden steel wire to file his way through the hinges of the cell. While Jo blocks the security camera and natters on, pretending to continue to conversation, the Doctor sneaks out. Donning a spacesuit, the Doctor exits the ship and makes his way across the hull and into the flight deck. The Master puts Jo in an airlock, threatening to eject her into space if the Doctor does not surrender, but the Doctor takes him by surprise. As the two face off, they do not notice a Draconian battlecruiser approaching. It docks, and enters the airlock where Jo is located.
The Draconian captain informs them that, as all diplomatic relations with Earth have been severed, violating Draconian space is punishable by death. The Doctor says he has vital evidence for the Emperor and asks to speak to him. The captain decides to lock up all three of them and take them back to Draconia. However, the Master secretly activates a device whose signal is picked up by the Ogrons.
As the ship arrives on Draconia, the Prince is speaking with his father, asking him for permission to strike first at Earth. The Emperor, like the President, is hesitant, as he knows such a war could bring down both empires.
The Doctor, Jo and the Master are presented to the Emperor and the Doctor gives the ritual greeting, "My life at your command." The Prince is incensed that the Doctor has the temerity to address the Emperor like a Draconian noble, but the Doctor says that he is a noble of Draconia — the title was given him by the 15th Emperor, five centuries before when he aided Draconia against a plague from outer space. The Doctor accuses the Master of trying to instigate a war between Earth and Draconia using Ogrons and the hypnosound device. As the Emperor considers this, a courtier announces that an Earth spaceship has arrived. Jo hears the sound of the sonic device, and realises it is the Ogrons. They burst in, guns blazing, and retreat with the Master, leaving several dead Draconians in their wake. One Ogron has been knocked out by the Doctor, and as the effects of the hypnosound fade, the Emperor sees the "Earthman" before him transform into its true form. He then realises the Doctor is speaking the truth.
The Emperor determines that the Ogron must be shown to the Earth authorities, but as a Draconian ship would be shot down, the Prince, the Doctor and Jo will take the Master's police ship. As they cross the frontier into Earth space, they spot another ship following them. However, by the time they identify it as the Ogron ship, it has already launched its missiles. As the Doctor take evasive action, the captive Ogron breaks out of its cell, overpowering its Draconian guard. It enters the flight deck and in the struggle cuts the ship's speed. The Prince and the Doctor subdue the Ogron, but the Master's ship catches up and a party boards the police ship. A firefight breaks out on the flight deck, just as an Earth battlecruiser shows up. The Master recalls the boarding party, who take Jo captive along with rescuing the Ogron prisoner, and their ship zips away. The Earth battlercruiser places the Doctor's ship under arrest.
Without the Ogron, the President is not convinced. The Doctor suggests an expedition to the Ogron homeworld, but Williams thinks it is a Draconian trick to divide Earth's forces. The Prince expects such a response from Williams — after all, he started the first war. Williams protests, but the Prince reveals what is in the Draconian court records. Twenty years before, the Draconians sent a battlecruiser to meet the Earth Empire on a diplomatic mission. When the Draconian ship did not answer the Earth ship's hails, Williams gave the order to attack, believing that the Draconian ship was about to attack his damaged vessel. The battlecruiser was unarmed, its missile banks empty, and the reason it did not answer was because its communications systems were destroyed in a neutron storm, the same storm that had damaged Williams's ship. Williams is shaken by the Prince's revelation and apologises for the wrong he had done to the Draconians. Williams now intends to lead the expedition to the Ogron planet himself.
The Master brings Jo to a bunker on the Ogron homeworld, where he shows her the TARDIS, which he plans to use as bait for the Doctor in addition to Jo herself. He tries to hypnotise Jo, first with his own powers and then with the hypnosound.
However, Jo's mind is strong enough to resist, and the Master orders her to be taken away. An Ogron reports that one of their ships found and attacked two Earth cargo ships, destroying one. The Master is delighted, as this means that war is not far off, and indeed, demands for war from Earth are at a fever pitch.
Williams prepares his personal scout ship, with the Doctor and the Prince accompanying and heads at maximum speed to the coordinates the Doctor took from the Master's ship. Jo manages to dig her way into the next, unlocked cell and sneak further into the bunker as Williams's ship enters orbit. She pockets the hypnosound, then finds a pad with the coordinates of the planet and bunker on it and transmits a distress signal with the information. The Master shows up, revealing that the signal was muted, and the only person who could have picked it up was the Doctor, whose ship he detected in orbit around the planet. When the Doctor comes, the trap will be sprung.
Williams's crew lands the scout nearby, not knowing the Ogrons have set up an ambush. The Ogrons open fire on the landing party, but are frightened away by an orange, slug-like lizard they call the Eater. The Master is furious, and warns the Ogrons that their masters are coming, which makes them even more terrified than they were of the monster. Williams's party hears the roar of a spaceship landing, and when they look up on the ridge, they see the Master... accompanied by several Daleks, who exterminate Williams's men before they can even fire. The Daleks want to exterminate the Doctor immediately, but the Master proposes that the Doctor be placed in his hands, to be allowed to see the galaxy and Earth in ruins before they kill him. The Gold Dalek agrees, and leaves for its ship, to go and prepare the Dalek army on another planet.
Answering the Prince's question, the Doctor explains that the Daleks want a war between Earth and Draconia so both empires will destroy each other, and then the Daleks can pick up the pieces. The Doctor modifies the stolen hypnosound, making the Ogron guard see him as the Gold Dalek, and in fear, it unlocks the gate to the cell. The Doctor tells Williams and the Prince to get the word back to their respective governments and mount a joint expedition against the base on the Ogron planet. The Doctor and Jo find their way to the TARDIS, but are surrounded by the Ogrons and the Master, who trains a blaster on the Doctor. The Doctor activates the hypnosound, panicking the Ogrons. One knocks the Master's arm, making him fire, the shot grazing the Doctor's head. The Master and the Ogrons scatter.
The Doctor, barely conscious, asks Jo to help him into the TARDIS. He staggers over to the console, dematerialising the ship, then pressing his palms to the telepathic circuits. He is sending a message to the Time Lords...