While caught up in a Time war between the past and the future on the planet Aoris, K9 was forced to spend a thousand years hidden on the planet, setting himself up as 'the great Machina' so that he could found a cult that would aid the Doctor and Romana in bringing the war to an end, hiding behind a fake computer with a version of the TARDIS until he could return to the Doctor and Romana once the war ended (AUDIO: The Paradox Planet, Legacy of Death).
The Virgin New Adventures seventh Doctor novel Lungbarrow (written by former Doctor TV series writer Marc Platt) featured K9s Marks I and II meeting for the first time on Gallifrey during the events surrounding the disappearance of the Doctor's entire family house and his living relatives, which also featured many previous established Gallifreyan based characters. The two collaborated towards rescuing the Doctor, then current companion Chris Cwej and the Doctor's lost family. This novel also served as the direct lead-in story to the 1996 Doctor Who telemovie.
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".