The TARDIS materialises on a distant planet in the far future. The Doctor, Steven and Dodo find the planet inhabited by both an advanced, idyllic civilisation (the Elders), and bands of roaming savages. The Elders welcome the Doctor, greeting him as "The Traveller from Beyond Time" and revealing they have admired his exploits from afar and predicted that he would soon be arriving here. Their leader Jano showers the Doctor and his companions with compliments and gifts, reinforcing the idyllic nature of the society of the Elders. However, the Doctor becomes suspicious of the Elders' seemingly perfect civilisation, but it is Dodo who finds the secret. The soldiers Exorse and Edal are sent outside the Elder city and use advanced weapons to capture the savages, entrapping them and returning them to the city. The Elders are only able to maintain the energy needed to run their civilisation by draining the life force of the helpless savages. The Doctor, appalled, tries to stop the Elders and persuade them of the wrong they are doing by building a civilisation on such immoral grounds.
Jano’s response is to have the Doctor himself subjected to the energy transfer process. The Doctor is put into the transfer device and his life force is channelled into the Elder Jano, who desires his intelligence. Yet the plan backfires when the Doctor's personality takes over Jano, imbuing him with the Doctor’s mannerisms, outlook and morality. The two identities cause Jano a personality crisis. Dodo and Steven have meanwhile ventured outside the city and made contact with the savage leaders Chal and Tor, who are respectively pleased and antagonised by their presence. The savages are the remnants of a once highly skilled and artistic race, but over the centuries the energy transfer process has stymied their creativity and ability. Chal hides the two fugitives in a deep cave system, pursued by the guard Exorse, whom Steven overpowers. They return to the city and find a weak but determined Doctor, and help him escape the city.
The time travellers now help the Savages fight back against the Elder guards. The Doctor realises that the Elders must be forced, not persuaded, to change their ways as their whole civilisation must change overnight. His mixed personality convinces Jano to help the Savages and he tries to convince the other Elders to treat the Savages as equals, while Exorse too has realised the error of his ways. Jano and Exorse begin the destruction of the technology underpinning the society and are soon joined in the destruction by the Doctor, Steven and Dodo. The end of the technology means the end of the oppression, and Jano and Chal begin to talk of how a new society can be built together. The Doctor surprises Steven by convincing him to remain behind as a mediator. When both sides agree to accept Steven's decision, he decides to stay. The Doctor and a saddened Dodo bid their friend goodbye.