As the darker side of the captain, Leggatt is the alter-ego of the narrator. With Leggatt the captain finds that "meaning depends upon sharing"; he and Leggatt stand against the bed talking in low tones for hours. Legatt is his secret sharer:
The self-possession of that man had somehow induced a corresponding state in myself....A mysterious communication was established already between us two--in the fact of that darkened tropical sea.
After hiding Leggatt, the captain knows what it is to have a friend, someone with whom to share secrets--someone by whom to measure himself.