Professor Frederick Marius, who invented the first K9 in the year 5000 while working on the asteroid K4067, described him as "my best friend and constant companion." Marius had a dog on Earth, but weight requirements did not allow him to bring his real dog into space, so he built K9. (TV: The Invisible Enemy) He built K9 by using the latest technology. Marius used his own medical computer, a state-of-the-art intraresponsive brain app, protective anti-radiation cladding, probes, a laser scapel, a vision and voice box and two scanning antennas. He put these parts together and created K9. (PROSE: One Man and His Dog) According to one account, the Professor copied the remnants of one of the versions of K9 created by the Doctor and given to Sarah Jane Smith. (PROSE: Tautology)
The Fourth Doctor found that K9 had contracted laryngitis and had lost his voice as a result of this. K9 was left in the TARDIS while the Doctor and Romana II battled the Daleks and Davros. (TV: Destiny of the Daleks) During a later adventure, he remained patiently in the TARDIS, which would imply that his voice had not yet returned. (TV: City of Death) After his voice returned, it sounded quite different and remained so for a while (TV: The Creature from the Pit) before the familiar voice returned. (TV: The Leisure Hive)
Before this, the Doctor obtained or constructed at least one backup model of K9. Immediately after leaving Mark I behind with Leela, he unpacked K9 Mark II. This version of K9 accompanied the Doctor and his new companion on their quest to locate the segments of the Key to Time, (TV: The Ribos Operation) but the swampy terrain of Delta III made it impossible for him to join them on the planet. At the conclusion of the quest, the Shadow turned K9 to his evil will, giving K9 a sinister personality. (TV: The Armageddon Factor)
The Fourth Doctor and K9 Mark II spent an indeterminate period of time together. However, the Doctor appeared to be activating K9 Mark II, implying that no significant time had elapsed since leaving Gallifrey. (TV: The Ribos Operation) It is possible that the Doctor spent some time at Nest Cottage before activating him. (AUDIO: The Stuff of Nightmares)
Introduced into the plot in The Invasion of Time, K9 Mark II first actually appear on-screen in The Ribos Operation (1978). More mobile than his predecessor, Mark II exhibited the ability to sense and warn others of danger. He travels as a companion alongside the Doctor and Romana. Around the time of Romana's regeneration (the transition from actress Mary Tamm to Lalla Ward), the K9 character was explained as suffering from "laryngitis" to accommodate Leeson's departure from the series at the start of the 1979–80 season; for this time, he was portrayed by David Brierley, until Leeson's return for the 1980–81 season. When the Doctor and Romana travel to the parallel universe of E-Space, K9 is severely damaged, in Warriors' Gate (1981). The damage was such that K9 could only function in E-Space; when Romana decided to stay and forge her own path, the Doctor gave K9 to her. The character makes subsequent appearances in remakes of the unfinished serial Shada, alongside the Eighth Doctor (Paul McGann); the 2003 Shada audio play and webcast depict K9 Mark II as having returned to Gallifrey with Romana, now Lady President of the Time Lords, where the Doctor visits them. It is not clear if either of these audio appearances are considered canonical in relation to the continuity of the TV series.