Tarrant bullies Vila into carrying out a task for the crew, even threatening to throw him off the ship if he refuses. They need crystals for their neutron blasts but the dealer will only meet with Vila. Avon has Vila swallow a tracer and they teleport him down. After he leaves, Avon and Cally castigate Tarrant for bullying Vila.
Vila reports the crystals have been delivered and Cally teleports down. Avon, suspicious, has her open the crate remotely. It explodes. The crew decide to rescue Vila, but it turns out he palmed the tracer and they have no way of finding him. Their only clue is a ruined city on the surface called the City at the Edge of the World.
Vila is brought into the city where he meets a pretty blond gangster named Kerril. She brings him to two other gangsters - a brash arrogant leader named Bayban and his bumbling lieutenant Sherm. Vila recognizes Bayban's name - he is a psychotic killer wanted by the Federation.
Bayban demands that Vila open a sealed door for him. Vila asks what is behind it and Bayban forces the native leader, Norl, to tell him - it contains "this world and the next". Bayban believes it means the wealth of the planet's former civilization. He has tried blasting the door but to no effect. He gives Vila an hour.
Avon and Cally teleport down to look for Vila.
Vila tells Kerril the block sealing the door is not real - it's a force field made to look like a block. Therefore it reflects energy blasts. He sets up a small probe to slowly bring it down.
Cally tries to talk to a natives but is ignored. They are interrupted by one of Bayban's men, whom Avon kills.
Norl watches Vila's work. Vila, knowing Bayban will kill him, tries to enlist Norl's help, but Norl is uninterested. Vila realized that Norl is using Bayban to open the door.
Not long after, a cleaned-up Kerril checks in on Vila. As they talk, the force field falls, revealing a corridor beyond. They go in and the door reappears behind them.
Cally and Avon capture several of Bayban's men and interrogate them.
Bayban, finding Vila gone, starts a search and has Sherm fetch his laser cannon.
Vila and Kerril find a second door. Vila is reluctant to open it because he thinks he is being used by Norl. Kerril goes in anyway and vanishes. Vila reluctantly follows and finds himself aboard a spaceship with Kerril and two ancient corpses.
A computer voice explains what has happened. 3000 years ago, their civilization was at its height but they realized that a collapse was imminent. They sent an automated starship into space to find a new world with a transmat linked back to the city. Every thousand years, the survivors of their civilization find someone to open the vault. If the man returns, they will know it is time to migrate. Otherwise, if the ship is in space, the air will run out and Vila and Kerril will die. Vila and Kerril, thinking they will soon die, fall into each other's arms.
The Liberator crew, now aware of Bayban's presence, launch an assault on the city.
Vila and Kerril find that they are still alive. Vila realizes that the ship has landed but the force field covering the exit has not opened. He takes a probe off one of the corpses and opens the hatch, revealing a beautiful planet beyond.
Avon and Cally are captured by Bayban. But Sherm returns to report on the fight and a struggle breaks out. Cally kills Sherm and they capture Bayban. Babyban doesn't know where Vila is but Norl tells them they are awaiting his return.
Vila finds the planet is covered with the crystals they need to repair the neutron blasters. His greed for them irritates Kerril and they decide to return.
When Vila returns, Norl's people wipe out the remainder of Bayban's army. They return in droves to the city and march through the portal to their new home.
Kerril asks Norl if she can go with them and he agrees. He offers Vila a place but Vila refuses - being a thief is who he is. Kerril begs him to come and tells her she loves him.
They are interrupted by the return of Bayban. Vila holds Bayban off so that Kerril and Norl can escape but the door seals behind them. Bayban, enraged, activate the laser cannon. Vila teleports up just before Bayban fires and destroys the entire city.