While on Gallifrey, he was framed for the murder of the Time Lord President by the Master, but by clever use of the legal system, staved off execution until he could unmask the real traitor and get himself elected President in the process. The Doctor would flee his responsibilities, however and pick up a new companion in the form of a scantily clad savage named Leela (a treat for older male viewers), and after that, the very popular robot dog K9. The Doctor soon returned to Gallifrey to reclaim his presidency. Eventually it was revealed that this was a ploy to reveal a Sontaran invasion plan. With the help of Leela and K-9, the Doctor defeated the Sontarans, but his two friends decided to remain on Gallifrey. The Doctor comforted himself by building K-9 Mk II.
Shortly afterwards, the powerful White Gaurdian assigned the Doctor to find the six segments of The Key To Time. To aid the Doctor in his quest, the Guardian sent a young Time Lady named Romana to join him. The two Gallifreyans were able to find the six segments and defeat the equally powerful Black Guardian, who sought the Key for himself. After the conclusion of the quest, Romana regenerated into a new form and after many further adventures with the Doctor, she chose to go off with K-9 to explore an alternate universe called E-space.
Shortly thereafter, the Doctor picked up a trio of young travelers, but after succeeding in stopping the Master from causing the heat death of the universe, he suffered a mortal fall from the top of a radio telescope. Before the eyes of the Doctor's new companions, the Doctor regenerated into a much younger man...