The TARDIS materialises in the marshes of the third moon of the planet Delta Magna. While attempting to locate the fifth segment of the Key to Time with the tracer, the Doctor is shot at by Thawn and Fenner, two workers from a nearby methane refinery. Romana is captured by Swampies, the green-skinned natives of the planet, who are in fact the descendants of the Delta Magnans, who were relocated to the moon by the human colonists of Delta Magna. The Swampies resent the intrusion of the refinery, which harvest methane from the swamps, converting it to protein for the Delta Magnans. The Swampies decide to sacrifice Romana to their god Kroll, prior to an attack on the hated refinery. The Doctor manages to rescue her, and they escape along with Rohm-Dutt, a gunrunner. Dutt is supplying weapons to the Swampies on behalf of the Sons of Delta Magna, an anti-colonial organisation that is sympathetic to the Swampies' plight. However, this is in reality part of a plan by Thawn; the weapons are useless, but will enable him to have an excuse to have the Swampies wiped out.
Meanwhile, the crew of the refinery notice that the bed of the lake is shifting, as if something underneath it were moving. The Swampies, led by Ranquin, prepare for their attack, but are stopped when Kroll, a gigantic squid-like creature, rises from the depths of the lake. Kroll attacks them, and in the chaos, the Doctor, Romana and Rohm-Dutt are captured by Swampies and sentenced to death. The Doctor and Romana escape, but Rohm-Dutt is crushed by one of Kroll's tentacles. The time travellers reach the refinery, where they learn that Thawn is planning to destroy Kroll with a rocket. After the Doctor disables the rocket, the Swampies attack the refinery, killing Thawn. Kroll returns, but the Doctor has realised that its enormous size is a result of swallowing the fifth segment, which was disguised as a holy relic of the natives. The Doctor uses the tracer to secure the segment, and Kroll is reduced to countless smaller creatures, scattered about the marshes.