After receiving another premonition of the Gallifreyan President being shot, the Doctor lands his Tardis inside the city. Its immediately detected and a squad of guards are sent to investigate. The Doctor realizes he's in trouble and opts to sneak out of the Tardis so he can warn the President of what's to come. Avoiding the guards, he makes his way for the Panoptican, but a guard captures him. With the Doctor is being held, an unknown person kills the guard, allowing the Doctor to escape.
The Doctor sneaks his way onto the Panoptican and runs into Runcible, an old classmate who is now essentially a Gallifreyan reporter. He's chastised by Borusa, a teacher from his academy but the Doctor talks to him while searching for the assassin. When Runcible has problems contacting his video technician from up above, the Doctor realizes that's where the shot killing the President will come from. He dives past the assembled Timelords as the President makes his way in.
Unfortunately, the Doctor is unable to prevent the assassination and is framed for the murder. Chancellor Goth is the leading candidate for the Presidency and likely the one who the President was going to name as his successor. Goth wants a swift trial and the Doctor executed as quickly as possible so the Timelords do not appear weak. Cardinal Borusa, is also an old teacher of the Doctor and against it, hoping for a just and fair trial.
The Doctor is on trial for his crime of assassinating the President where he maintains his innocence. Wanting a swift trial, Goth is quick to declare the Doctor guilty. But the Doctor has a trick up his sleeve when he declares 'Article 17', announcing himself as a Presidential candidate. Under Gallifreyan law, he is protected until the next President is declared. The Doctor doesn't expect to win, he just knows it's given him more time to plead his case. Once free, he convinces Castellan Spandrell of his innocence and how he was framed.
The Matrix is a Gallifreyan computer capable of predicting events in the future. The answers the Doctor needs are within, so with Spandrell's help, he projects himself into the Matrix. There, he's hunted by the real killer of the President who needs to kill the Doctor now from discovering the secrets. The Doctor discovers he's being hunted by Goth, the real killer of the President. Having defeated him, the Doctor leaves the Matrix and searches for Goth, now outside the Matrix also. The Doctor realizes someone must be controlling Goth.
What the Doctor finds shocks both him and Spandrell. The Master has arrived on Gallifrey to steal the power the President controls to renew his regenerative cycle. The Master has used up all 12 of his regenerations and wants more, even if it comes to destroying all of Gallifrey. The Master fakes his own death and while in the morgue gains control of the Sash of Rassilon, to protect him from being pulled into the Eye of Harmony - the great source of Timelord power. The Doctor is able to stop the Master, but he gets away, still horribly disfigured.
NEXT: Something For the Dads