The TARDIS arrives on a planet where a savage tribe called the Sevateem worship a god named Xoanon. The Fourth Doctor discovers that Xoanon is in fact a spaceship computer that he tried to repair at some point in his past and inadvertently drove mad by giving it a multiple personality. It is tended to by another tribe of humanoids, the ascetic Tesh. These are the descendants of the ship's original technicians, while the Sevateem are the descendants of the original survey team. The Doctor, with the help of a Sevateem girl named Leela, manages to gain access to the ship and wipe the additional personalities from the computer, leaving it sane and in proper control once more. Leela, deciding that she no longer wants to stay on her own planet, pushes her way on board the TARDIS. Doctor Who has gained another companion.