Almost as soon as he arrived, K9 Mark IV left Sarah Jane to stabilise a dangerous black hole in space which had been created in Switzerland. He could only speak with Sarah Jane occasionally via a cabinet with a space-time link when the orbit of the black hole intersected with Earth's and did not know when he would complete the job. (TV: Invasion of the Bane) However, he returned to Earth very briefly during emergencies. He did so on two later occasions in order to render vital assistance. The first time, he fought Mr Smith in pitched battle to give Sarah Jane time to upload the Armageddon Virus. (TV: The Lost Boy) The second time, he quickly uploaded TARDIS base codes to Mr Smith, assisting the Tenth Doctor in returning Earth to its correct location in space. (TV: Journey's End)
K9, retroactively "K9 Mark I" (Leeson), initially appeared in The Invisible Enemy (1977) as the creation of Professor Marius (Frederick Jaeger) in the year 5000. K9 subsequently travelled with the Fourth Doctor (Tom Baker) and Leela (Louise Jameson) as a companion of the Doctor in his adventures in time and space until The Invasion of Time (1978). In this serial, K9 decides to remain on the Doctor's home planet of Gallifrey with Leela. Immediately afterwards, Doctor Who would introduce a second incarnation of K9, played by the same prop; the last scene of The Invasion of Time shows the Doctor unpacking a box labeled "K9 Mk II".