The Doctor is pleased when Compassion, his humanoid TARDIS, materialises in an underground cave, where she runs less risk of being picked up on a random scan by the Time Lords. The cave itself is an intriguing combination of types, but as the Doctor tries to puzzle out the apparent geological discrepancies he and his companions hear a horrible scream in the distance. The Doctor sets off to investigate, but his torch batteries fail on the way, and once plunged into darkness he and his companions are attacked by carnivorous, bat-like creatures. They are saved by Brevus, a miner searching for his missing friend Graco. Graco had set off to investigate trouble with the ice mineís deep-steam extractors, but failed to return, and from what the Doctor and his friends say, it appears that he has fallen victim to a knivor swarm. Brevus escorts the Doctor, Fitz and Compassion out of the mine, intending to take them to the city of Baktan; there, they can explain their presence, and Fitzís knivor bites can be treated. On the way to Baktan, Fitz is tended to by a slave girl who is not permitted to speak or have a name, and he decides to call her Florence.
The travellers have arrived on Eskon, a planet which was recently (in geological terms) baked by an intense solar flare which robbed the atmosphere of moisture. The natives dwell in cities carved from sandstone, and their only sources of fresh water are the natural ice reservoirs in the planetís cold heart. As they approach Baktan, the Doctor sees that the city is surrounded by a shantytown, but Brevus dismisses its residents as ďslimersĒ -- the scum of society, murderers, bandits and killers all. The Doctor, however, notes the brutality with which the guards clear a path for the sandcar, and is not so sure. As the sandcar enters the city, one of the slimers who had been beaten by the guards succumbs to his injuries and undergoes the horrific death known as the Squirming. The slimersí self-elected spokesperson, Revan, loathes the city which has rejected his kind, and plans to bring the people of Baktan to their knees...
The visitors are warmly welcomed by Anavolus and Krumm of the city Forum, but receive a much chillier reception from the third member of the Forum, the priest Tor Grymna. Aliens have visited Eskon in the past, but have always abandoned the planet to its fate upon realising that it has no exports worth exploiting. Tor Grymna is thus profoundly mistrustful of the new arrivals, and proudly insists that his people will solve their problems themselves. The Doctor is not so sure that they can, particularly when he learns that the so-called slimers are in fact victims of a degenerative disorder which has struck the most recent generation of Baktanís young -- and that rather than search for a cure, the Forum has responded by exiling them from the city to keep their gene pool pure. This has created a community of angry and resentful individuals right on the cityís doorstep -- and since the cause of the mutation has not been found, the planetís other cities have placed Baktan under quarantine and are refusing to trade with them, creating further anger and resentment towards the slimers in the city.
Convinced from his behaviour that Tor Grymna is hiding something, the Doctor sends Fitz to his quarters to investigate. Fitz is forced to hide when the priest unexpectedly returns, and overhears Tor Grymna speaking to his son Ckeho, whom Tor Grymna keeps locked up in his room. Tor Grymna loathes the slimers for what their disgusting presence has done to his beloved city, and is seriously considering burning the shantytown to the ground and killing them all. Tor Grymna storms out of his home, feeling no better for having spoken with his disgraceful son, and Fitz emerges from hiding and tries to speak with Ckeho. Ckeho begs Fitz to set him free, and Fitz does so -- and Ckeho, himself a slimer, knocks Fitz out of the way and flees. Once Fitz has recovered from the shock, he reports to the Doctor, who has learned that Tor Grymna rejected his family group to join the priesthood, possibly for political reasons -- which would make him an even more dangerous adversary should he learn that Fitz is responsible for threatening to expose the fact that his son is a slimer. Ckeho must have fled to the shantytown, the only place where he will be accepted; the Doctor therefore asks Fitz to look for him in the morning, while the Doctor speaks with the slimers to learn their point of view.
The next day, the Doctor, Fitz and Compassion are escorted to the shantytown, where Fitz slips away to search for Ckeho while the Doctor speaks with Revan. Revan is too full of rage to listen to reason, however, and he attacks the Doctor, who is forced back to retreat to the city while the Custodians hold off the attacking slimers. Fitz locates Ckeho, who has not found the reception he expected; he may be a slimer but he is also the son of Tor Grymna, one of the most prominent and brutal of the slimersí oppressors. Revan catches them together, but Fitz saves their lives by convincing him to use Ckehoís existence as political capital; if the people of the city learn that Tor Grymna has a slimer for a son, his reputation will be ruined. Revan agrees to spare Fitz as well, but only if Fitz helps him to capture the ice mine and hold Baktanís water supply hostage. When the appalled Fitz refuses, Revan shows him a dying slimer, injured while fighting with the Doctorís escort -- and forces him to watch as wormlike embryos burrow out of the slimerís flesh, killing him horribly. This is the inevitable fate awaiting all slimers -- and Revan, willing to do anything to avenge their fate, will not hesitate to kill Fitz if he becomes useless...
While outside the city, the Doctor and Compassion noticed that the cracks in the bedrock seemed to be widening, albeit at a nearly imperceptible rate. Seeking evidence of tectonic movement, Compassion looks through the ice mineís records, and discovers that the first cases of the slimer mutation occurred shortly after the miners began tapping into the deep ice reservoirs, further than they had ever gone before. The Doctor analyses a water sample from the mine and determines that it has been contaminated by something alien to Eskonís biosphere, which has been passing undetected through Baktanís water purification system. The Doctor intends to take an expedition to the deep ice reservoirs to discover the truth, but Brevus reluctantly admits that this may be more dangerous than the Doctor had anticipated. The missing Graco was actually investigating the disappearance of a party of miners working on the deep-steam extractors; only one of the men returned, a man named Akestus -- a veteran of the mines who has since been too terrified to return. He cannot recall exactly what happened, and knows only that something in the darkness took his men. The Doctor presents his evidence to the Forum, and to his surprise, Tor Grymna agrees to authorise the expedition and to allow a team of Custodians to escort him and Brevus. What the Doctor doesnít know is that Tor Grymna, convinced that Ckehoís condition is a divine retribution for his having slept with a slave girl before his sonís birth, is desperate to prevent the truth of his sonís condition from getting out -- and that he intends to have the shantytown razed to the ground, and the slaughter blamed on the Doctor.
Fitz and Ckeho escape from the slimers and get back to the city gates, and while the guards are fighting off their angry pursuers, they manage to slip inside. Fitz takes Ckeho to confront Tor Grymna, but the furious priest will not listen to them, and Fitz storms out on him in disgust upon realising that Tor Grymnaís hatred of the slimers has blinded him to reason. He returns to his guest quarters, and he and Florence watch in despair as the Custodians surround the shantytown and set it ablaze, killing many of its inhabitants. Meanwhile, Tor Grymna throws Ckeho out of his home, finding that even now he cannot bring himself to kill his own son -- but outside, Ckeho is spotted by a group of frightened citizens, who instantly give chase. Cornered, he retreats back to his fatherís home, and Tor Grymna refuses to let the angry citizens kill him and expels them from his house. Soon, everybody in the city knows the truth...
The Doctorís expedition enters the ice mines, and the Doctor uses an ultrasonic whistle to drive off the knivor swarms. One of the Custodians slips and falls while crossing an ice bridge over a gaping abyss, however, and Compassion also falls while trying to save his life. She survives the fall, but the impact throws her internal dimensions out of synch; until she can repair the damage, nobody will be able to enter her. Feeling unaccountably upset by her failure to save the falling Custodianís life, she starts to climb out of the mine -- and as she does so, she finds the wreckage of a spaceship from the Aayavex system, which has been buried in the ice for millions of years. Meanwhile, the rest of the expedition continues onwards, and the Doctor follows a foul stench to a vast cavern, the end of the trail -- where his escorts, acting on orders from Tor Grymna, prepare to kill him. Before they can do so, however, a monstrous slug the size of a whale slithers into the cavern and begins to eat the terrified Custodians. The Doctor and Brevus escape, and the Doctor identifies the monster as a Spulver worm, one of the few species to survive the genetic wars which ravaged the third moon of Aayavex. A Spulver worm can survive terrible wounds and go without eating for decades, but it appears that this one is mortally injured, possibly the tectonic shifts which the Doctor and Compassion had noticed earlier. A gaping wound has been torn in its side, and has become infected -- and the discharge from the wound has been contaminating the ice with the Spulver wormís powerfully mutagenic DNA, thus creating the slimers.
The Doctor and Brevus return to the surface, only to find that Revan and his slimers have taken over the mine. Under cover of the guardsí attack on the shantytown, Revan entered the city and kidnapped Akestus, and has forced him to show Revan the location of the main water pumps and operating mechanisms. The miners have been using thermionic charges to speed-melt reservoirs of ice, but now Revan intends to use those charges to blow up the mine. The Doctor and Brevus attempt to stop him, but in the course of the fight Akestus is killed and Revan detonates the bombs manually. He is killed in the blast, and the destruction of the mine causes a chain reaction through the thermionic charges already planted in the ice, speed-melting untapped reservoirs of ice throughout the caves. The Doctor and Brevus return to Baktan with their warning, to find that the Forum is threatened by scandal, the slimers have been massacred, and the sudden loss of so much ice has caused further tectonic disturbances which threaten to topple the city into the bedrock. And then Compassion arrives with even worse news -- the speed-melting reservoirs have exposed a clutch of the Spulver wormís eggs, which are hatching and seeking food. Within hours the city will be overrun.
Anavolus and Krumm arrange the emergency evacuation, while the Doctor and Compassion plan to return to the ice mine and use strategically planted thermionic charges to melt an even larger reservoir of ice, thus flushing the Spulver worm and its contamination away down one of the nearby fault lines. Many of Baktanís citizens manage to evacuate before the Spulver embryos arrive, but many others are slaughtered -- including Anavolus and Florence. Baktan has fallen to the Spulver worms, and Tor Grymna has disappeared, leaving Krumm the only member of the Forum. As he tries to guide his shaken people, the Doctor and Compassion return to the caves, only to find that Tor Grymna has beaten them there. He now understands that the slimers are the innocent victims of an alien infection, and to atone for his crimes he intends to kill the Spulver worm himself. The Doctor tries to warn him that one thermionic charge will not kill the worm; it will simply bring down the roof, blocking off the cavern and leaving the contamination here to poison future generations. Tor Grymna is too far gone to listen, however, and as he fights the Doctor, the Doctor alters the bombís settings and throw it back to him. The bomb starts to warm up in Tor Grymnaís hands, and the Spulver worm, sensing the new heat source, eats both Tor Grymna and the bomb.
The charge then detonates inside the Spulver worm, blowing it to pieces -- and, as the Doctor had feared, causing the roof to collapse. By now Compassion has planted her charges, however, and the Doctor contacts her telepathically and urges her to detonate them right away. She does so, and the speed-melting ice reservoirs flush away the contamination before the collapsing cavern blocks off the fault lines. Compassion has repaired herself by now, and takes the Doctor inside to safety while the cavern fills with water. When she surfaces, they find that the city of Baktan has subsided into the desert, crushing all of the Spulver embryos. The new lake formed by the melting reservoirs is free of contamination. Brevus, Krumm and Ckeho will make up the new Forum, and intend to lead their people to a brighter destiny. The Doctor, Fitz and Compassion depart for new times, and further adventures.