After finally dropping Tegan off at Heathrow airport, Nyssa and the Doctor are busy doing some repairs to the Tardis. He fixes the audio on the scanner when Nyssa suggests fixing other features of the Tardis, such as the Tardis' state of temporal grace. It's then they notice a 'massive source of magnetic radiation' targeting the Tardis. It enters the Tardis and attempts to bond with the Doctor. Though it's initial attempt fails, the Doctor realizes the danger is far from over. Especially when Nyssa points out the creature was comprised of anti-matter.
The Timelords of Gallifrey have noticed the bonding attempt and also realize how dangerous such a bond could be. They forceably recall the Doctors Tardis back to Gallifrey. The Tardis materializes in a locked room and the Doctor soon meets Maxil, one of the Chancellery guards. (Ironically, the character is played by Colin Baker who later goes on to play the Doctor in future stories.) Taking no chances, Maxil disables the Tardis.
Back on Earth, Tegan is on Holiday in Amsterdam. When she tries to meet her favourite cousin, she runs into his friend instead who claims he's missing. The story he tells is so fantastic, he can't even tell the police. Tegan however, is more ready to listen. Doing some of her own investigation she finds her cousin Colin, but he seems to be possessed. Tegan then finds out who is responsible for possession, it's the same creature who tried to bond with the Doctor. Scanning her brain, he discovers she's known to the Doctor. He decides to use her as bait against the Doctor.
Back on Gallifrey, the Doctor is sentenced to death to prevent another bonding with the creature. Borusa, the Castallen and the other Timelords of the High Council almost unanimously passed the decree, with only one person holding out, Hedin, a one time friend of the Doctor. Nyssa attempts to rescue the Doctor and pulls a gun on the High Council. The Doctor tries to put Nyssa at ease and takes the gun away from her. As a last wish, he requests the council overlook her zealous misplaced loyalty. The High council agree and place the Doctor in the disintegration booth. Nyssa watches in horror as the Doctor dissolves.
The Doctor has actually not been vaporized, but placed inside the Matrix. He discovers it's Omega who's trying to bond with him. Omega promises to release the Doctor if he promises not to try and stop him, but the Doctor says he'll do whatever he can to stop him. Currently Omegas Tardis is in Amsterdam and he's captured Tegan so he uses her as a hostage to get the Doctors loyalty. The Doctor finally admits he can't leave Gallifrey anyway. The Doctor is finally released and despite promising Omega, he tries to leave Gallifrey and head to Amsterdam thanks to Tegan boldly ignoring Omega's threats. Once out of the matrix, the Doctor learns his friend Hedin is working with Omega.
Hedin has laid evidence making it look like President Borusa is responsible for a previous murder and for working with Omega. When the Castellan finds the President he aims to arrest him. When he discovers the Doctor is still alive and with Borusa, he immediately sentences him to death and fires his weapon, but Hedin jumps in front of the blast, saving the Doctor. Borusa explains to the Castellan that Hedin was the traitor, not himself or the Doctor. Now knowing where Omega is, the Timelords help the Doctor escape Gallifrey without being detected by Omega.
The Timelords are just able to help the Doctor escape. Having landed in Amsterdam, the Doctor finds Omega and Tegan but Omega quickly escapes when his Tardis explodes. But he mentions the Doctor is too late and quickly escapes in a body that has bonded with normal space. Shaking the dust off, Nyssa and the Doctor, now with Tegan following along chase after Omega. They discover a man who's been killed and his clothes taken. The Doctor stresses how important it is to find Omega because his bond is not permanent.
It's not long before Omega also discovers his bond is not permanent. In blind fear, he tries to evade the Doctor and ultimately hopes to take the rest of the universe with him when he finally returns back to anti-matter and disperses. Fortunately the Doctor catches up with him and puts Omega out of his misery before he can explode, saving the universe and giving Omega the only freedom he can truly have. It's then Tegan mentions to Nyssa she was fired from her job so the Tardis is now stuck with her. Nyssa gives Tegan a hug, the Doctor doesn't look so pleased.