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 was not originally intended to be a companion, but producer Graham Williams liked the concept so much that the decision was made to retain him as a regular character, in order to appeal to the younger members of the audience. The original name for the character was "FIDO" — apparently from "Phenomenal [sic] Indication Data Observation" unit — but it was eventually named K9.
Within the series' narrative, K9 is a robot dog acquired by Doctor Who's title character in the 1977 serial The Invisible Enemy. The first two incarnations of the character travelled alongside the Fourth Doctor (portrayed by Tom Baker) until 1981. In these stories, K9 proved useful for the powerful laser weapon concealed in his nose, his encyclopaedic knowledge and his vast computer intelligence. By 1981, each of the two models of K9 which travelled alongside the Doctor had been left with one of the Doctor's female companions. The character subsequently transitioned into spin-off territory. Producers hoped K9's popularity with children would launch the series K9 and Company, led by actress Elisabeth Sladen in the role of companion Sarah Jane Smith alongside a new K9. In 2006, K9 reappeared in the revived series of Doctor Who. Although the character's appearances in the 2007 spin-off The Sarah Jane Adventures were hampered by the concurrent development of the K9 spin-off, the character began to appear full-time in both K9 and The Sarah Jane Adventures, depicting adventures of the original K9 Mark I and of Mark IV, respectively.