K9 Mark III first appeared in "A Girl's Best Friend", the 1981 pilot for a series, K-9 and Company, which never materialized beyond the first episode. In this, the character is presented to the Doctor's former companion Sarah Jane Smith (Elisabeth Sladen); together, the two embark on what a number of adventures. Only the first of these is depicted on-screen; several are shown in comic book and audio play adaptations, and others are alluded to by the television series. Mark III made a brief appearance alongside Sarah Jane in the Doctor Who 20th anniversary ninety-minute special The Five Doctors (1983), before appearing properly and for the final time in the revived series' episode "School Reunion" in 2006. By the time of that story, Mark III has fallen into disrepair and eventually sacrifices himself to stop a plot by the alien Krillitane and defeat their leader, Lucas Finch (Anthony Head). In the episode's conclusion, the Doctor presents Sarah Jane with a new K9 to encourage her to continue investigating alien activity; the Doctor "rebuilt" him after the Mark III's sacrifice, implying that he had the same mind and memories as his predecessor while still being a "brand new model".
In 1985, a series of gamebooks featuring the Sixth Doctor were published by Severn House under the title Make your own adventure with Doctor Who in Britain and Find Your Fate — Doctor Who in the United States. These books were actually written by scriptwriters for the television series. Martin wrote Search for the Doctor which takes place in the mid-21st century and features K9 Mark IV being reunited with the Sixth Doctor long after Sarah's death.
When Romana eventually returned to her own universe, she brought K9 Mark II with her (presumably having repaired it) and eventually became Lady President of Gallifrey. K9 Mark II is first seen on Gallifrey in the Virgin New Adventures novel Lungbarrow by Marc Platt, alongside K9 Mark I, which had remained with Leela. Both K9 Mark I and Mark II appear, voiced by Leeson, in the Big Finish Productions audio adventure Zagreus and the Gallifrey audio series. Leela's K9 (Mark I) was destroyed at the conclusion of the second Gallifrey series and only Mark II appears in the third series.
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.