Later that year, during a return visit to Starbase 11, Hansen was placed in temporary command of the Enterprise when Captain Kirk and Lieutenant Commander Spock, Kirk's first officer, transported to the surface in order to investigate a mysterious message that apparently had been sent from the starbase. Spock later relieved Hansen of command while secretly attempting to illegally transport Fleet CaptainChristopher Pike to Talos IV. When Spock was forced to confess his subterfuge, he transferred operational command back to Hansen, who subsequently transferred it to Kirk, upon Kirk's return to the ship. (TOS: "The Menagerie, Part I")

The role Hansen plays in "Court Martial" and the "The Menagerie" two-parter was originally written for Sulu. As such, Hansen wasn't included in either of the scripts for those episodes, which featured Sulu instead, as did the shooting schedule for "Court Martial".

Although he knew both James Doohan and William Shatner prior to appearing on Star Trek: The Original Series, the casting of Hagan Beggs as Lieutenant Hansen wasn't due to either. "It came about by my agent at that time sending me out to see about that role," Beggs clarified. "It wasn't a case of Doohan saying you gotta see this Canadian guy." (These Are the Voyages: TOS Season One) Clearly using the actor's first name as a basis, the call sheets for "Court Martial" consistently referred to this character as "Hagan".

The part of Lieutenant Hansen was discontinued by Gene Roddenberry. Hagan Beggs remembered, "Gene brought me in to his office after we finished shooting and said, 'Everything is fine with your work but I'm making a change in the helmsman; I think I need to spread this out a bit more. So thank you very much, but I want to try to make it bigger – I think it's got great possibilities.' I said, 'Okay,' and went on to do some other shows, and didn't think much about it." (These Are the Voyages: TOS Season One) Beggs further related, "I believe I was removed from the helmsman position because they decided to have more of a flavor than the basic North American white person. They went with someone else." (Starlog #130, p. 75)

Hagan Beggs was initially very humble about having appeared as Hansen, but, years after leaving the role, Beggs reassessed this viewpoint. "It wasn't until a few years later, when the show was gaining renewed popularity in reruns, that I even thought I should put it back on my resume as being involved," Beggs explained. "I'd always felt slightly embarrassed because I'm thinking, 'My God, I'm literally sitting at a board pushing a couple of levers and people are giving me this great credit for being on this show, you know.' Yes, I did take the captain's chair at one point, but didn't see my part as being that important. In time, I became awakened to how popular this show was and how much it meant to so many people. It's phenomenal. Where it has all gone is totally amazing. It's by default that I'm luckily in the iconic grouping, and it was simply, honest to God, by me just being there. Because what I had to do was pretty simple." (These Are the Voyages: TOS Season One) Talking approximately twenty years after appearing as Hansen, Beggs speculated, "I don't think those who are avidly interested in Star Trek would put me together [with Lt. Hansen] at all. I'm bald now, and in those days, I had hair." (Starlog #130, p. 75)