The initial intention of John Nathan Turner for a significant returning character, for the 1983 serial ‘Mawdryn Undead’, was First Doctor companion Ian Chesterton, played by William Russell; he had played the part from Doctor Who’s very beginning in 1963 to 1965. He was to have returned for a guest appearance in this Fifth Doctor story, hence the school setting, as Ian had been a science teacher.
Unfortunately, however, actor William Russell was not available for the filming schedule required, so JNT shifted his gaze to other male companions from the show’s history. Some consideration was given to using Harry Sullivan (played by Ian Marter), who was a regular for one series (alongside the Fourth Doctor and Sarah Jane). However, once the production team discovered they could hire Nicholas Courtney for another appearance as Brigadier Lethbridge-Stewart, they decided upon him.